summaryrefslogtreecommitdiff
blob: 14b10c1fb8328ba40fbfe2d6ab8976d00f115a86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Avoid using strchrnul, it's a GNU addition.  The code in question,
actually doesn't really benefit from strchrnul's behaviour.

--- config.c
+++ config.c
@@ -351,20 +351,21 @@
 		 * marker if it occurs at the beginning of the line, or after
 		 * whitespace
 		 */
-		hashmarker = strchrnul(line, '#');
+		hashmarker = strchr(line, '#');
 		if (line == hashmarker)
 			line[0] = '\0';
 		else {
-			while (hashmarker[0] != '\0') {
+			while (hashmarker != NULL) {
 				--hashmarker;
-				if (isblank(hashmarker[0]))
+				if (isblank(hashmarker[0])) {
 					hashmarker[0] = '\0';
-				else {
+					break;
+				} else {
 					/*
 					 * false positive; '#' occured
 					 * within a string
 					 */
-					hashmarker = strchrnul(hashmarker+2, '#');
+					hashmarker = strchr(hashmarker+2, '#');
 				}
 			}
 		}