All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Optimize tests and remove shadowed local variable.
@ 2018-09-12 23:09 Leonardo Brás
  0 siblings, 0 replies; only message in thread
From: Leonardo Brás @ 2018-09-12 23:09 UTC (permalink / raw)
  To: linux-kernel

Removes an unnecessary shadowed local variable (start).
Optimize test of isdigit:
- If isalpha returns true, isdigit will return false, so no need to test.

Signed-off-by: Leonardo Brás <leobras.c@gmail.com>
---
 scripts/asn1_compiler.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/asn1_compiler.c b/scripts/asn1_compiler.c
index c146020fc783..a0056df4e358 100644
--- a/scripts/asn1_compiler.c
+++ b/scripts/asn1_compiler.c
@@ -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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-09-12 23:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-12 23:09 [PATCH] Optimize tests and remove shadowed local variable Leonardo Brás

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.