1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-18 15:21:16 +02:00

26583: use HOOK_FUNCTIONS more widely

This commit is contained in:
Peter Stephenson 2009-02-19 10:12:37 +00:00
parent 6d52e0ae1a
commit 64d011185a
4 changed files with 16 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2009-02-19 Peter Stephenson <pws@csr.com>
* 26583: Src/init.c, Src/zsh.h: use HOOK_SUFFIX more widely
for "*_functions" arrays.
2009-02-18 Peter Stephenson <p.w.stephenson@ntlworld.com> 2009-02-18 Peter Stephenson <p.w.stephenson@ntlworld.com>
* Jörg Sommer: 26582: Completion/Unix/Command/_date: --rfc-3339 * Jörg Sommer: 26582: Completion/Unix/Command/_date: --rfc-3339
@ -11205,5 +11210,5 @@
***************************************************** *****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL * This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.4572 $ * $Revision: 1.4573 $
***************************************************** *****************************************************

View file

@ -150,7 +150,7 @@ loop(int toplevel, int justonce)
if (toplevel && if (toplevel &&
(getshfunc("preexec") || (getshfunc("preexec") ||
paramtab->getnode(paramtab, "preexec_functions"))) { paramtab->getnode(paramtab, "preexec" HOOK_SUFFIX))) {
LinkList args; LinkList args;
char *cmdstr; char *cmdstr;

View file

@ -1174,8 +1174,6 @@ callhookfunc(char *name, LinkList lnklst, int arrayp, int *retval)
if (arrayp) { if (arrayp) {
char **arrptr; char **arrptr;
int namlen = strlen(name); int namlen = strlen(name);
#define HOOK_SUFFIX "_functions"
#define HOOK_SUFFIX_LEN 11 /* including NUL byte */
VARARR(char, arrnam, namlen + HOOK_SUFFIX_LEN); VARARR(char, arrnam, namlen + HOOK_SUFFIX_LEN);
memcpy(arrnam, name, namlen); memcpy(arrnam, name, namlen);
memcpy(arrnam + namlen, HOOK_SUFFIX, HOOK_SUFFIX_LEN); memcpy(arrnam + namlen, HOOK_SUFFIX, HOOK_SUFFIX_LEN);

View file

@ -1117,6 +1117,15 @@ struct funcwrap {
#define WRAPDEF(func) \ #define WRAPDEF(func) \
{ NULL, 0, func, NULL } { NULL, 0, func, NULL }
/*
* User-defined hook arrays
*/
/* Name appended to function name to get hook array */
#define HOOK_SUFFIX "_functions"
/* Length of that including NUL byte */
#define HOOK_SUFFIX_LEN 11
/* node in builtin command hash table (builtintab) */ /* node in builtin command hash table (builtintab) */
/* /*