Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kconfig: rename a variable in the lexer to a clearer name

In Kconfig, like Python, you can enclose a string by double-quotes or
single-quotes. So, both "foo" and 'foo' are allowed.

The variable, "str", is used to remember whether the string started with
a double-quote or a single-quote because open/closing quotation marks
must match.

The name "str" is too generic to understand the intent. Rename it to
"open_quote", which is easier to understand. The type should be 'char'.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Boris Kolpackov <boris@codesynthesis.com>

+3 -3
+3 -3
scripts/kconfig/lexer.l
··· 84 84 n [A-Za-z0-9_-] 85 85 86 86 %% 87 - int str = 0; 87 + char open_quote = 0; 88 88 89 89 #.* /* ignore comment */ 90 90 [ \t]* /* whitespaces */ ··· 133 133 ":=" return T_COLON_EQUAL; 134 134 "+=" return T_PLUS_EQUAL; 135 135 \"|\' { 136 - str = yytext[0]; 136 + open_quote = yytext[0]; 137 137 new_string(); 138 138 BEGIN(STRING); 139 139 } ··· 170 170 append_string(yytext + 1, yyleng - 1); 171 171 } 172 172 \'|\" { 173 - if (str == yytext[0]) { 173 + if (open_quote == yytext[0]) { 174 174 BEGIN(INITIAL); 175 175 yylval.string = text; 176 176 return T_WORD_QUOTE;