kbuild: Removes unnecessary shadowed local variable and optimize testing.
PATCH 3/4 kbuild: Removes unnecessary shadowed local variable and optimize testing.
Removes an unnecessary shadowed local variable (start). Optimize test of isdigit:
- If isalpha returns true, isdigit will return false, so no need to test.
--- scripts/asn1_compiler.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
scripts/asn1_compiler.c +3 -4
@@ -413,7 +413,7 @@ static void tokenise(char *buffer, char *end)/* Handle string tokens */ if (isalpha (*p)) { -const char **dir, *start = p; +const char **dir;/* Can be a directive, type name or element * name. Find the end of the name.
@@ -454,10 +454,9 @@ static void tokenise(char *buffer, char *end) tokens[tix++].token_type =TOKEN_TYPE_NAME ;continue ; - } + }else if (isdigit (*p)) { +/* Handle numbers */ -/* Handle numbers */ -if (isdigit (*p)) {/* Find the end of the number */ q = p +1 ;while (q < nl && (isdigit (*q)))
Signature · 1 line
2.19.1
Hi Leonardo,
Quoted 3 lines · Leonardo Brás
Removes an unnecessary shadowed local variable (start). Optimize test of isdigit:
- If isalpha returns true, isdigit will return false, so no need to test.
This patch does two different things, it should be in two separated patches.
Quoted 20 lines
Signed-off-by Leonardo Brás <[email protected]>--- scripts/asn1_compiler.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)scripts/asn1_compiler.c +1
-1@@ -413,7 +413,7 @@ static void tokenise(char *buffer, char *end)/* Handle string tokens */ if (isalpha (*p)) { -const char **dir, *start = p; +const char **dir;/* Can be a directive, type name or element * name. Find the end of the name.
scripts/asn1_compiler.c static void tokenise(char *buffer, char *end) · line 458
Quoted 6 lines
scripts/asn1_compiler.c +2
-1@@ -454,10 +454,9 @@ static void tokenise(char *buffer, char *end) tokens[tix++].token_type =TOKEN_TYPE_NAME ;continue ; - } + }else if (isdigit (*p)) { +/* Handle numbers */
Actually you can't do that, p is being altered in the first if statement.
scripts/asn1_compiler.c static void tokenise(char *buffer, char *end)
Quoted 7 lines
scripts/asn1_compiler.c +0
-2-/* Handle numbers */ -if (isdigit (*p)) {/* Find the end of the number */ q = p +1 ;while (q < nl && (isdigit (*q)))
Regards
Helen
Hello Helen,
Quoted 9 lines · Helen Koike
Hi Leonardo,
Quoted 3 lines · Leonardo Brás
Removes an unnecessary shadowed local variable (start). Optimize test of isdigit:
- If isalpha returns true, isdigit will return false, so no need to test.This patch does two different things, it should be in two separated patches.
Sure, no problem.
Quoted 22 lines
Quoted 22 lines
Signed-off-by Leonardo Brás <[email protected]>--- scripts/asn1_compiler.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)scripts/asn1_compiler.c +1
-1@@ -413,7 +413,7 @@ static void tokenise(char *buffer, char *end)/* Handle string tokens */ if (isalpha (*p)) { -const char **dir, *start = p; +const char **dir;/* Can be a directive, type name or element * name. Find the end of the name. @@ -454,10 +454,9 @@ static void tokenise(char *buffer, char *end)
Quoted 7 lines
scripts/asn1_compiler.c static void tokenise(char *buffer, char *end) · line 458
Quoted 5 lines
scripts/asn1_compiler.c +2
-1tokens[tix++].token_type =TOKEN_TYPE_NAME ;continue ; - } + }else if (isdigit (*p)) { +/* Handle numbers */ Actually you can't do that, p is being altered in the first if statement.
Yeah, you are right. I will remove this logic for v2.
Quoted 11 lines
scripts/asn1_compiler.c static void tokenise(char *buffer, char *end)
Quoted 8 lines
scripts/asn1_compiler.c +0
-2-/* Handle numbers */ -if (isdigit (*p)) {/* Find the end of the number */ q = p +1 ;while (q < nl && (isdigit (*q)))Regards
Helen
Thanks!
Leonardo Brás
Quoted 45 lines · Leonardo Bras
Hello Helen,
Quoted 9 lines · Helen Koike
Hi Leonardo,
Quoted 3 lines · Leonardo Brás
Removes an unnecessary shadowed local variable (start). Optimize test of isdigit:
- If isalpha returns true, isdigit will return false, so no need to test.This patch does two different things, it should be in two separated patches.
Sure, no problem.
Quoted 22 lines
Quoted 22 lines
Signed-off-by Leonardo Brás <[email protected]>--- scripts/asn1_compiler.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)scripts/asn1_compiler.c +1
-1@@ -413,7 +413,7 @@ static void tokenise(char *buffer, char *end)/* Handle string tokens */ if (isalpha (*p)) { -const char **dir, *start = p; +const char **dir;/* Can be a directive, type name or element * name. Find the end of the name. @@ -454,10 +454,9 @@ static void tokenise(char *buffer, char *end)Quoted 7 lines
scripts/asn1_compiler.c static void tokenise(char *buffer, char *end) · line 458
Quoted 5 lines
scripts/asn1_compiler.c +2
-1tokens[tix++].token_type =TOKEN_TYPE_NAME ;continue ; - } + }else if (isdigit (*p)) { +/* Handle numbers */ Actually you can't do that, p is being altered in the first if statement.
Quoted 1 line
Yeah, you are right. I will remove this logic for v2.
I drop v1 from my tree.
Please send v2.
Quoted 15 lines
Quoted 11 lines
scripts/asn1_compiler.c static void tokenise(char *buffer, char *end)
Quoted 8 lines
scripts/asn1_compiler.c +0
-2-/* Handle numbers */ -if (isdigit (*p)) {/* Find the end of the number */ q = p +1 ;while (q < nl && (isdigit (*q)))Regards
HelenThanks!
Leonardo Brás
Signature · 2 lines
Best Regards Masahiro Yamada