Skip to contentSkip to conversation

fixdep: remove redundant null character check

PATCH In review Masahiro Yamada 1 participant 2 messages Feb 18, 2020 – Feb 27, 2020 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fixdep: remove redundant null character check

If *q is '\0', the condition (isalnum(*q) || *q == '_') is false anyway.

Ensuring non-zero *q is redundant.

---

 scripts/basic/fixdep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/basic/fixdep.c +1 -1
index ad2041817985..877ca2c88246 100644
@@ -246,7 +246,7 @@ static void parse_config_file(const char *p)
 		}
 		p += 7;
 		q = p;
-		while (*q && (isalnum(*q) || *q == '_'))
+		while (isalnum(*q) || *q == '_')
 			q++;
 		if (str_ends_with(p, q - p, "_MODULE"))
 			r = q - 7;
Signature · 1 line
2.17.1
#1 lore raw
Quoted 7 lines · Masahiro Yamada

If *q is '\0', the condition (isalnum(*q) || *q == '_') is false anyway.

Ensuring non-zero *q is redundant.

---

Applied to linux-kbuild.

Quoted 19 lines
 scripts/basic/fixdep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/basic/fixdep.c +1 -2
index ad2041817985..877ca2c88246 100644
@@ -246,7 +246,7 @@ static void parse_config_file(const char *p)
                }
                p += 7;
                q = p;
-               while (*q && (isalnum(*q) || *q == '_'))
+               while (isalnum(*q) || *q == '_')
                        q++;
                if (str_ends_with(p, q - p, "_MODULE"))
                        r = q - 7;
--

2.17.1

Signature · 2 lines
Best Regards
Masahiro Yamada