diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-07-18 15:48:53 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-07-18 15:50:04 +0200 |
commit | 8b08d5a502adec2067e3ebf7f27513f75b0b95e8 (patch) | |
tree | 5a449ce75ecd4aeb6ef7a88e5e539f1c6f711c9b | |
parent | 4c201c00a3650cdacad5fc098ca255416687fb0f (diff) | |
download | busybox-w32-8b08d5a502adec2067e3ebf7f27513f75b0b95e8.tar.gz busybox-w32-8b08d5a502adec2067e3ebf7f27513f75b0b95e8.tar.bz2 busybox-w32-8b08d5a502adec2067e3ebf7f27513f75b0b95e8.zip |
hush: smaller code to set o_string to ""
function old new delta
encode_then_expand_vararg 399 398 -1
parse_stream 2753 2748 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/hush.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/shell/hush.c b/shell/hush.c index 7da8f334c..534fabbd0 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -4997,8 +4997,7 @@ static struct pipe *parse_stream(char **pstring, | |||
4997 | /* If very first arg is "" or '', ctx.word.data may end up NULL. | 4997 | /* If very first arg is "" or '', ctx.word.data may end up NULL. |
4998 | * Preventing this: | 4998 | * Preventing this: |
4999 | */ | 4999 | */ |
5000 | o_addchr(&ctx.word, '\0'); | 5000 | ctx.word.data = xzalloc(1); /* start as "", not as NULL */ |
5001 | ctx.word.length = 0; | ||
5002 | 5001 | ||
5003 | /* We used to separate words on $IFS here. This was wrong. | 5002 | /* We used to separate words on $IFS here. This was wrong. |
5004 | * $IFS is used only for word splitting when $var is expanded, | 5003 | * $IFS is used only for word splitting when $var is expanded, |
@@ -5795,8 +5794,7 @@ static char *encode_then_expand_vararg(const char *str, int handle_squotes, int | |||
5795 | */ | 5794 | */ |
5796 | 5795 | ||
5797 | setup_string_in_str(&input, str); | 5796 | setup_string_in_str(&input, str); |
5798 | o_addchr(&dest, '\0'); | 5797 | dest.data = xzalloc(1); /* start as "", not as NULL */ |
5799 | dest.length = 0; | ||
5800 | exp_str = NULL; | 5798 | exp_str = NULL; |
5801 | 5799 | ||
5802 | for (;;) { | 5800 | for (;;) { |