init: fix the parse error when meeting escape characters
After dealing with some specical escape characters('\n','\r','\t','\\',"\r\n") it doesn't goto the next position in the next loop, so it process the current character twice. For example, when parsing the string "test\ntoken" we expect the "test'\n'token" but actually we got the "test'\n'ntoken" Test: have espace characters in init .rc files Change-Id: I015c087a5c6e5ee9c490f29a83b15b89443f7f81 Signed-off-by: liwugang <liwugang@xiaomi.com>
This commit is contained in:
parent
fc1cf90741
commit
332afef5f4
1 changed files with 5 additions and 0 deletions
|
@ -85,15 +85,19 @@ textresume:
|
|||
goto textdone;
|
||||
case 'n':
|
||||
*s++ = '\n';
|
||||
x++;
|
||||
break;
|
||||
case 'r':
|
||||
*s++ = '\r';
|
||||
x++;
|
||||
break;
|
||||
case 't':
|
||||
*s++ = '\t';
|
||||
x++;
|
||||
break;
|
||||
case '\\':
|
||||
*s++ = '\\';
|
||||
x++;
|
||||
break;
|
||||
case '\r':
|
||||
/* \ <cr> <lf> -> line continuation */
|
||||
|
@ -101,6 +105,7 @@ textresume:
|
|||
x++;
|
||||
continue;
|
||||
}
|
||||
x++;
|
||||
case '\n':
|
||||
/* \ <lf> -> line continuation */
|
||||
state->line++;
|
||||
|
|
Loading…
Reference in a new issue