aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-01-03 14:08:18 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2023-01-03 14:08:18 +0100
commit969e00816835769429fcd98046313f66b1c194fb (patch)
tree89521baf6154acf3424690eac2bbe762887f08d5
parentd488a5218b378631ab78c3358dab9498426bc777 (diff)
downloadbusybox-w32-969e00816835769429fcd98046313f66b1c194fb.tar.gz
busybox-w32-969e00816835769429fcd98046313f66b1c194fb.tar.bz2
busybox-w32-969e00816835769429fcd98046313f66b1c194fb.zip
hush: code shrink
function old new delta run_list 1032 1012 -20 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/hush.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 693099209..d111f0cc5 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -2460,10 +2460,15 @@ static int set_local_var(char *str, unsigned flags)
2460 return retval; 2460 return retval;
2461} 2461}
2462 2462
2463static int set_local_var0(char *str)
2464{
2465 return set_local_var(str, 0);
2466}
2467
2463static void FAST_FUNC set_local_var_from_halves(const char *name, const char *val) 2468static void FAST_FUNC set_local_var_from_halves(const char *name, const char *val)
2464{ 2469{
2465 char *var = xasprintf("%s=%s", name, val); 2470 char *var = xasprintf("%s=%s", name, val);
2466 set_local_var(var, /*flag:*/ 0); 2471 set_local_var0(var);
2467} 2472}
2468 2473
2469/* Used at startup and after each cd */ 2474/* Used at startup and after each cd */
@@ -6964,7 +6969,7 @@ static NOINLINE int expand_one_var(o_string *output, int n,
6964 val = NULL; 6969 val = NULL;
6965 } else { 6970 } else {
6966 char *new_var = xasprintf("%s=%s", var, val); 6971 char *new_var = xasprintf("%s=%s", var, val);
6967 set_local_var(new_var, /*flag:*/ 0); 6972 set_local_var0(new_var);
6968 } 6973 }
6969 } 6974 }
6970 } 6975 }
@@ -9373,7 +9378,7 @@ static NOINLINE int run_pipe(struct pipe *pi)
9373 } 9378 }
9374#endif 9379#endif
9375 debug_printf_env("set shell var:'%s'->'%s'\n", *argv, p); 9380 debug_printf_env("set shell var:'%s'->'%s'\n", *argv, p);
9376 if (set_local_var(p, /*flag:*/ 0)) { 9381 if (set_local_var0(p)) {
9377 /* assignment to readonly var / putenv error? */ 9382 /* assignment to readonly var / putenv error? */
9378 rcode = 1; 9383 rcode = 1;
9379 } 9384 }
@@ -9856,7 +9861,7 @@ static int run_list(struct pipe *pi)
9856 } 9861 }
9857 /* Insert next value from for_lcur */ 9862 /* Insert next value from for_lcur */
9858 /* note: *for_lcur already has quotes removed, $var expanded, etc */ 9863 /* note: *for_lcur already has quotes removed, $var expanded, etc */
9859 set_local_var(xasprintf("%s=%s", pi->cmds[0].argv[0], *for_lcur++), /*flag:*/ 0); 9864 set_local_var_from_halves(pi->cmds[0].argv[0], *for_lcur++);
9860 continue; 9865 continue;
9861 } 9866 }
9862 if (rword == RES_IN) { 9867 if (rword == RES_IN) {