diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-09 12:58:19 +0200 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-09 12:58:19 +0200 |
commit | 850b15bfafb08d24ae3e55f5ca8b848b17958f8a (patch) | |
tree | 27e7b4f4b32674b6b7c204f07ce241044005ce94 | |
parent | 77a7b5519cace3722832d03ce09faa950841b509 (diff) | |
download | busybox-w32-850b15bfafb08d24ae3e55f5ca8b848b17958f8a.tar.gz busybox-w32-850b15bfafb08d24ae3e55f5ca8b848b17958f8a.tar.bz2 busybox-w32-850b15bfafb08d24ae3e55f5ca8b848b17958f8a.zip |
hush: simplify parse_stream_dquoted
function old new delta
parse_stream_dquoted 303 250 -53
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-rw-r--r-- | shell/hush.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/shell/hush.c b/shell/hush.c index d76fe85f6..5af525982 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -3777,15 +3777,12 @@ static int parse_stream_dquoted(o_string *as_string, | |||
3777 | * NB: in (unquoted) heredoc, above does not apply to ". | 3777 | * NB: in (unquoted) heredoc, above does not apply to ". |
3778 | */ | 3778 | */ |
3779 | if (next == dquote_end || strchr("$`\\\n", next) != NULL) { | 3779 | if (next == dquote_end || strchr("$`\\\n", next) != NULL) { |
3780 | ch = i_getch(input); | 3780 | ch = i_getch(input); /* eat next */ |
3781 | if (ch != '\n') { | 3781 | if (ch == '\n') |
3782 | o_addqchr(dest, ch); | 3782 | goto again; /* skip \<newline> */ |
3783 | nommu_addchr(as_string, ch); | 3783 | } /* else: ch remains == '\\', and we double it */ |
3784 | } | 3784 | o_addqchr(dest, ch); |
3785 | } else { | 3785 | nommu_addchr(as_string, ch); |
3786 | o_addqchr(dest, '\\'); | ||
3787 | nommu_addchr(as_string, '\\'); | ||
3788 | } | ||
3789 | goto again; | 3786 | goto again; |
3790 | } | 3787 | } |
3791 | if (ch == '$') { | 3788 | if (ch == '$') { |
@@ -3808,13 +3805,6 @@ static int parse_stream_dquoted(o_string *as_string, | |||
3808 | } | 3805 | } |
3809 | #endif | 3806 | #endif |
3810 | o_addQchr(dest, ch); | 3807 | o_addQchr(dest, ch); |
3811 | if (ch == '=' | ||
3812 | && (dest->o_assignment == MAYBE_ASSIGNMENT | ||
3813 | || dest->o_assignment == WORD_IS_KEYWORD) | ||
3814 | && is_well_formed_var_name(dest->data, '=') | ||
3815 | ) { | ||
3816 | dest->o_assignment = DEFINITELY_ASSIGNMENT; | ||
3817 | } | ||
3818 | goto again; | 3808 | goto again; |
3819 | #undef as_string | 3809 | #undef as_string |
3820 | } | 3810 | } |