From 63442b3eaa58d5fd140306bd2ce85dd994284889 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 23 Apr 2004 11:17:13 +0000 Subject: 19810: ksh autoloading 19812: autoloaded traps which are still buggy. --- Src/builtin.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'Src/builtin.c') diff --git a/Src/builtin.c b/Src/builtin.c index 010c8c1f3..b8fd3f3b8 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -2515,12 +2515,13 @@ bin_functions(char *name, char **argv, Options ops, int func) shf = (Shfunc) zshcalloc(sizeof *shf); shf->flags = on; shf->funcdef = mkautofn(shf); + shfunctab->addnode(shfunctab, ztrdup(*argv), shf); if (!strncmp(*argv, "TRAP", 4) && (signum = getsignum(*argv + 4)) != -1) { if (settrap(signum, shf->funcdef)) { - freeeprog(shf->funcdef); - zfree(shf, sizeof(*shf)); + shfunctab->removenode(shfunctab, *argv); + shfunctab->freenode((HashNode)shf); returnval = 1; ok = 0; } @@ -2528,12 +2529,9 @@ bin_functions(char *name, char **argv, Options ops, int func) sigtrapped[signum] |= ZSIG_FUNC; } - if (ok) { - shfunctab->addnode(shfunctab, ztrdup(*argv), shf); - if (OPT_ISSET(ops,'X') && - eval_autoload(shf, shf->nam, ops, func)) - returnval = 1; - } + if (ok && OPT_ISSET(ops,'X') && + eval_autoload(shf, shf->nam, ops, func)) + returnval = 1; } else returnval = 1; } -- cgit v1.2.3