(svn r4489) - Codechange: some small cleanups in the settings-parser code, mainly substituting terminating 0 characters with '\0'.
authorDarkvater
Thu, 20 Apr 2006 22:08:20 +0000
changeset 3598 a02daaf41761
parent 3597 51e18e76be0b
child 3599 c09257ed88f8
(svn r4489) - Codechange: some small cleanups in the settings-parser code, mainly substituting terminating 0 characters with '\0'.
settings.c
--- a/settings.c	Thu Apr 20 21:19:20 2006 +0000
+++ b/settings.c	Thu Apr 20 22:08:20 2006 +0000
@@ -185,15 +185,15 @@
 	while (fgets(buffer, sizeof(buffer), in)) {
 
 		// trim whitespace from the left side
-		for (s = buffer; s[0] == ' ' || s[0] == '\t'; s++);
+		for (s = buffer; *s == ' ' || *s == '\t'; s++);
 
 		// trim whitespace from right side.
 		e = s + strlen(s);
 		while (e > s && ((c=e[-1]) == '\n' || c == '\r' || c == ' ' || c == '\t')) e--;
-		*e = 0;
+		*e = '\0';
 
 		// skip comments and empty lines
-		if (*s == '#' || *s == 0) {
+		if (*s == '#' || *s == '\0') {
 			uint ns = comment_size + (e - s + 1);
 			uint a = comment_alloc;
 			uint pos;
@@ -224,7 +224,7 @@
 			}
 		} else if (group) {
 			// find end of keyname
-			for (t=s; *t != 0 && *t != '=' && *t != '\t' && *t != ' '; t++) {}
+			for (t = s; *t != '\0' && *t != '=' && *t != '\t' && *t != ' '; t++);
 
 			// it's an item in an existing group
 			item = ini_item_alloc(group, s, t-s);
@@ -247,8 +247,8 @@
 			if (*t == '\"') t++;
 			// remove ending quotation marks
 			e = t + strlen(t);
-			if (e > t && e[-1] =='\"') e--;
-			*e = 0;
+			if (e > t && e[-1] == '\"') e--;
+			*e = '\0';
 
 			item->value = pool_strdup(&ini->pool, t, e - t);
 		} else {
@@ -405,7 +405,7 @@
 		if (p == end || n == maxitems) return -1;
 		p = end;
 		items[n++] = v;
-		if (*p == 0) break;
+		if (*p == '\0') break;
 		if (*p != ',') return -1;
 		p++;
 	}