hush: simplify parse_stream_dquoted

function                                             old     new   delta
parse_stream_dquoted                                 303     250     -53

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This commit is contained in:
Denys Vlasenko 2010-09-09 12:58:19 +02:00
parent 77a7b5519c
commit 850b15bfaf

View File

@ -3777,15 +3777,12 @@ static int parse_stream_dquoted(o_string *as_string,
* NB: in (unquoted) heredoc, above does not apply to ". * NB: in (unquoted) heredoc, above does not apply to ".
*/ */
if (next == dquote_end || strchr("$`\\\n", next) != NULL) { if (next == dquote_end || strchr("$`\\\n", next) != NULL) {
ch = i_getch(input); ch = i_getch(input); /* eat next */
if (ch != '\n') { if (ch == '\n')
goto again; /* skip \<newline> */
} /* else: ch remains == '\\', and we double it */
o_addqchr(dest, ch); o_addqchr(dest, ch);
nommu_addchr(as_string, ch); nommu_addchr(as_string, ch);
}
} else {
o_addqchr(dest, '\\');
nommu_addchr(as_string, '\\');
}
goto again; goto again;
} }
if (ch == '$') { if (ch == '$') {
@ -3808,13 +3805,6 @@ static int parse_stream_dquoted(o_string *as_string,
} }
#endif #endif
o_addQchr(dest, ch); o_addQchr(dest, ch);
if (ch == '='
&& (dest->o_assignment == MAYBE_ASSIGNMENT
|| dest->o_assignment == WORD_IS_KEYWORD)
&& is_well_formed_var_name(dest->data, '=')
) {
dest->o_assignment = DEFINITELY_ASSIGNMENT;
}
goto again; goto again;
#undef as_string #undef as_string
} }