summaryrefslogtreecommitdiff
path: root/settings.c
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2006-04-20 22:08:20 +0000
committerDarkvater <Darkvater@openttd.org>2006-04-20 22:08:20 +0000
commitf9c99a809b0bbd19ce89c632cc98a37a589dd526 (patch)
tree22f4d2901c600a2d654d9a088ed5c667cb099d6b /settings.c
parentedc5b8ba4b4b6e5039c218574e4058ed45bfce2f (diff)
downloadopenttd-f9c99a809b0bbd19ce89c632cc98a37a589dd526.tar.xz
(svn r4489) - Codechange: some small cleanups in the settings-parser code, mainly substituting terminating 0 characters with '\0'.
Diffstat (limited to 'settings.c')
-rw-r--r--settings.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/settings.c b/settings.c
index 7cb7783c7..6123356fa 100644
--- a/settings.c
+++ b/settings.c
@@ -185,15 +185,15 @@ static IniFile *ini_load(const char *filename)
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 @@ static IniFile *ini_load(const char *filename)
}
} 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 @@ static IniFile *ini_load(const char *filename)
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 @@ static int parse_intlist(const char *p, int *items, int maxitems)
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++;
}