aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-09-25 02:58:20 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-09-25 02:58:20 +0200
commit726e1a04f7fdf9a646614352cd8c4a371dda6eda (patch)
tree89c1be1ddbc2097d10979a021cc3ce76b81cf1be
parente305c28285ac365d6573802b33a2d542fd236022 (diff)
downloadbusybox-w32-726e1a04f7fdf9a646614352cd8c4a371dda6eda.tar.gz
busybox-w32-726e1a04f7fdf9a646614352cd8c4a371dda6eda.tar.bz2
busybox-w32-726e1a04f7fdf9a646614352cd8c4a371dda6eda.zip
ash: even smaller `trap` code
function old new delta evalvar 1371 1373 +2 trapcmd 347 260 -87 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 37bdc701a..0cada0474 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4601,8 +4601,7 @@ forkchild(struct job *jp, union node *n, int mode)
4601 * 4601 *
4602 * Our solution: ONLY bare $(trap) or `trap` is special. 4602 * Our solution: ONLY bare $(trap) or `trap` is special.
4603 */ 4603 */
4604 /* This is needed to prevent EXIT trap firing and such 4604 /* This is needed to prevent EXIT trap firing and such */
4605 * (trap_ptr will be freed in trapcmd()) */
4606 trap_ptr = memcpy(xmalloc(sizeof(trap)), trap, sizeof(trap)); 4605 trap_ptr = memcpy(xmalloc(sizeof(trap)), trap, sizeof(trap));
4607 } 4606 }
4608 clear_traps(); 4607 clear_traps();
@@ -12271,14 +12270,18 @@ trapcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
12271 single_quote(tr), 12270 single_quote(tr),
12272 (signo == 0 ? "" : "SIG"), 12271 (signo == 0 ? "" : "SIG"),
12273 get_signame(signo)); 12272 get_signame(signo));
12274 if (trap_ptr != trap) 12273 /* trap_ptr != trap only if we are in special-cased `trap` code.
12275 free(tr); 12274 * In this case, we will exit very soon, no need to free(). */
12275 /* if (trap_ptr != trap) */
12276 /* free(tr); */
12276 } 12277 }
12277 } 12278 }
12279 /*
12278 if (trap_ptr != trap) { 12280 if (trap_ptr != trap) {
12279 free(trap_ptr); 12281 free(trap_ptr);
12280 trap_ptr = trap; 12282 trap_ptr = trap;
12281 } 12283 }
12284 */
12282 return 0; 12285 return 0;
12283 } 12286 }
12284 12287