OSDN Git Service

kconfig: narrow the scope of variables in the lexer
authorMasahiro Yamada <masahiroy@kernel.org>
Mon, 27 Sep 2021 12:54:36 +0000 (21:54 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Wed, 29 Sep 2021 17:05:10 +0000 (02:05 +0900)
The variables, "ts" and "i", are used locally in the action of
the [ \t]+ pattern in the <HELP> start state.

Define them where they are used.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/kconfig/lexer.l

index 312cbad..efe4878 100644 (file)
@@ -85,7 +85,6 @@ n     [A-Za-z0-9_-]
 
 %%
        int str = 0;
-       int ts, i;
 
 #.*                    /* ignore comment */
 [ \t]*                 /* whitespaces */
@@ -196,6 +195,8 @@ n   [A-Za-z0-9_-]
 
 <HELP>{
        [ \t]+  {
+               int ts, i;
+
                ts = 0;
                for (i = 0; i < yyleng; i++) {
                        if (yytext[i] == '\t')