Skip to contentSkip to conversation

lib/string.c: Two if-clauses merged

PATCH In review Andi Drebes 3 participants 3 messages Oct 28, 2006 – Nov 1, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/string.c: Two if-clauses merged

The patch just deletes two lines of code and nothing else. Tested by compilation.

lib/string.c +1 -3
@@ -43,9 +43,7 @@
 			c2 = *s2;
 			s1++;
 			s2++;
-			if (!c1)
-				break;
-			if (!c2)
+			if (!c1 || !c2)
 				break;
 			if (c1 = c2)
 				continue;

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw
Quoted 6 lines · Andi Drebes

The patch just deletes two lines of code and nothing else. Tested by compilation.

lib/string.c line 47

Quoted 8 lines
lib/string.c +1 -3
@@ -43,9 +43,7 @@
 			c2 = *s2;
 			s1++;
 			s2++;
-			if (!c1)
-				break;
-			if (!c2)
+			if (!c1 || !c2)
 				break;

Hmm... There are probably thousands of places like this. And checking one thing at a time is in many cases better than one long check.

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw
In reply to Andi Drebes
Quoted 4 lines · Alexey Dobriyan
Quoted 2 lines · Andi Drebes

The patch just deletes two lines of code and nothing else. Tested by compilation.

Quoted 14 lines

lib/string.c line 47

Quoted 11 lines
lib/string.c +1 -3
@@ -43,9 +43,7 @@
 			c2 = *s2;
 			s1++;
 			s2++;
-			if (!c1)
-				break;
-			if (!c2)
+			if (!c1 || !c2)
 				break;

Hmm... There are probably thousands of places like this. And checking one thing at a time is in many cases better than one long check.

The generated code is in both cases the same.

cu
Adrian

Signature · 9 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors