Commit 2c986b8f7e0c4aa36f452ee05715a26fac32c39e

Omar Polo 2022-07-04T09:15:23

check for specific chars instead of using isspace(3) Reminded by naddy and stsp; it was missing a cast to unsigned char to prevent issues on archs with signed chars and was too broad anyway. While here, drop an extra check immediately after. ok stsp@

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/lib/patch.c b/lib/patch.c
index f12c747..dbbc9b3 100644
--- a/lib/patch.c
+++ b/lib/patch.c
@@ -415,11 +415,11 @@ linecmp(const char *a, const char *b, int *mangled)
 
 	*mangled = 1;
 	for (;;) {
-		while (isspace(*a))
+		while (*a == '\t' || *a == ' ' || *a == '\f')
 			a++;
-		while (isspace(*b))
+		while (*b == '\t' || *b == ' ' || *b == '\f')
 			b++;
-		if (*a == '\0' || *b == '\0' || *a != *b)
+		if (*a == '\0' || *a != *b)
 			break;
 		a++, b++;
 	}