strcmp: Remove unnecessary check for *r
authorMichael Forney <mforney@mforney.org>
Tue, 5 Nov 2013 05:48:08 +0000 (21:48 -0800)
committerRich Felker <dalias@aerifal.cx>
Sat, 23 Nov 2013 21:17:38 +0000 (16:17 -0500)
If *l == *r && *l, then by transitivity, *r.

src/string/strcmp.c

index 91eb7404fd2bc127c7db8b65038356b1c2ec7873..808bd8370ddeca3a2cfc124601cbd6012be89f80 100644 (file)
@@ -2,6 +2,6 @@
 
 int strcmp(const char *l, const char *r)
 {
-       for (; *l==*r && *l && *r; l++, r++);
+       for (; *l==*r && *l; l++, r++);
        return *(unsigned char *)l - *(unsigned char *)r;
 }