Skip to contentSkip to conversation

kbuild: Optimize tests and remove shadowed local variable.

PATCH In review Leonardo Brás 2 participants 5 messages Sep 18, 2018 – Oct 10, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: Optimize tests and remove shadowed local variable.

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 | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/asn1_compiler.c +4 -4
index c146020fc783..a0056df4e358 100644
@@ -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,10 @@ static void tokenise(char *buffer, char *end)
 
 				tokens[tix++].token_type = TOKEN_TYPE_NAME;
 				continue;
-			}
 
-			/* Handle numbers */
-			if (isdigit(*p)) {
+			} else if (isdigit(*p)) {
+				/* Handle numbers */
+
 				/* Find the end of the number */
 				q = p + 1;
 				while (q < nl && (isdigit(*q)))
Signature · 1 line
2.19.0
Reviewed-by on v1 1/1
#1 lore raw

FW: David Howells

2018-09-19 8:00 GMT+09:00 Leonardo Brás <[email protected]>:

Quoted 5 lines

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 was sent to me, but maybe belong to David's field.

David, will you take care of this patch?

https://lore.kernel.org/patchwork/patch/988171/

I think the commit subject should be changed kbuild: -> ASN.1:

Anyway, this patch looks trivial,
FWIW

Quoted 34 lines
---
 scripts/asn1_compiler.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/asn1_compiler.c +4 -5
index c146020fc783..a0056df4e358 100644
@@ -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,10 @@ static void tokenise(char *buffer, char *end)
 
                                tokens[tix++].token_type = TOKEN_TYPE_NAME;
                                continue;
-                       }
 
-                       /* Handle numbers */
-                       if (isdigit(*p)) {
+                       } else if (isdigit(*p)) {
+                               /* Handle numbers */
+
                                /* Find the end of the number */
                                q = p + 1;
                                while (q < nl && (isdigit(*q)))
--

2.19.0

Signature · 2 lines
Best Regards
Masahiro Yamada
#2 lore raw

Hello David,

My name is Leonardo and I am new to kernel development.

Is this patch acceptable? Do it need some rework? The change makes sense? Is there a way to better follow the workflow for this patch?

Please let me know if it needs anything.

Best regards,

Leonardo Bras

Quoted 70 lines · Masahiro Yamada

FW: David Howells

2018-09-19 8:00 GMT+09:00 Leonardo Brás <[email protected]>:

Quoted 5 lines

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 was sent to me, but maybe belong to David's field.

David, will you take care of this patch?

https://lore.kernel.org/patchwork/patch/988171/

I think the commit subject should be changed kbuild: -> ASN.1:

Anyway, this patch looks trivial,
FWIW

Quoted 32 lines
---
 scripts/asn1_compiler.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/asn1_compiler.c +4 -5
index c146020fc783..a0056df4e358 100644
@@ -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,10 @@ static void tokenise(char *buffer, char *end)
 
                                tokens[tix++].token_type = TOKEN_TYPE_NAME;
                                continue;
-                       }
 
-                       /* Handle numbers */
-                       if (isdigit(*p)) {
+                       } else if (isdigit(*p)) {
+                               /* Handle numbers */
+
                                /* Find the end of the number */
                                q = p + 1;
                                while (q < nl && (isdigit(*q)))
--
Quoted 2 lines

2.19.0

--
Best Regards
Masahiro Yamada

#3 lore raw

Hi Leonardo, David,

Quoted 9 lines · Leonardo Bras

Hello David,

My name is Leonardo and I am new to kernel development.

Is this patch acceptable? Do it need some rework? The change makes sense? Is there a way to better follow the workflow for this patch?

Please let me know if it needs anything.

I thought David would pick this up,
but he is not responding.

Now, applied to my kbuild tree.

Thanks.

Quoted 77 lines

Best regards,

Leonardo Bras

Quoted 70 lines · Masahiro Yamada

FW: David Howells

2018-09-19 8:00 GMT+09:00 Leonardo Brás <[email protected]>:

Quoted 5 lines

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 was sent to me, but maybe belong to David's field.

David, will you take care of this patch?

https://lore.kernel.org/patchwork/patch/988171/

I think the commit subject should be changed kbuild: -> ASN.1:

Anyway, this patch looks trivial,
FWIW

Quoted 32 lines
---
 scripts/asn1_compiler.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/asn1_compiler.c +4 -5
index c146020fc783..a0056df4e358 100644
@@ -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,10 @@ static void tokenise(char *buffer, char *end)
 
                                tokens[tix++].token_type = TOKEN_TYPE_NAME;
                                continue;
-                       }
 
-                       /* Handle numbers */
-                       if (isdigit(*p)) {
+                       } else if (isdigit(*p)) {
+                               /* Handle numbers */
+
                                /* Find the end of the number */
                                q = p + 1;
                                while (q < nl && (isdigit(*q)))
--
Quoted 2 lines

2.19.0

--
Best Regards
Masahiro Yamada

Signature · 2 lines
Best Regards
Masahiro Yamada
#4 lore raw

Thank you!

Please let me know if it needs any rework!

Leonardo Bras

Quoted 108 lines · Masahiro Yamada

Hi Leonardo, David,

Quoted 9 lines · Leonardo Bras

Hello David,

My name is Leonardo and I am new to kernel development.

Is this patch acceptable? Do it need some rework? The change makes sense? Is there a way to better follow the workflow for this patch?

Please let me know if it needs anything.

I thought David would pick this up,
but he is not responding.

Now, applied to my kbuild tree.

Thanks.

Quoted 77 lines

Best regards,

Leonardo Bras

Quoted 70 lines · Masahiro Yamada

FW: David Howells

2018-09-19 8:00 GMT+09:00 Leonardo Brás <[email protected]>:

Quoted 5 lines

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 was sent to me, but maybe belong to David's field.

David, will you take care of this patch?

https://lore.kernel.org/patchwork/patch/988171/

I think the commit subject should be changed kbuild: -> ASN.1:

Anyway, this patch looks trivial,
FWIW

Quoted 32 lines
---
 scripts/asn1_compiler.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/asn1_compiler.c +4 -5
index c146020fc783..a0056df4e358 100644
@@ -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,10 @@ static void tokenise(char *buffer, char *end)
 
                                tokens[tix++].token_type = TOKEN_TYPE_NAME;
                                continue;
-                       }
 
-                       /* Handle numbers */
-                       if (isdigit(*p)) {
+                       } else if (isdigit(*p)) {
+                               /* Handle numbers */
+
                                /* Find the end of the number */
                                q = p + 1;
                                while (q < nl && (isdigit(*q)))
--
Quoted 2 lines

2.19.0

--
Best Regards
Masahiro Yamada

--
Best Regards
Masahiro Yamada