diff options
author | Darkvater <darkvater@openttd.org> | 2006-04-20 22:08:20 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2006-04-20 22:08:20 +0000 |
commit | abf0d81782400e89285bb4f929b3876bf2e1d2ab (patch) | |
tree | 22f4d2901c600a2d654d9a088ed5c667cb099d6b | |
parent | b23e85a7be8b5ffb70fb343a90a644d2029d890e (diff) | |
download | openttd-abf0d81782400e89285bb4f929b3876bf2e1d2ab.tar.xz |
(svn r4489) - Codechange: some small cleanups in the settings-parser code, mainly substituting terminating 0 characters with '\0'.
-rw-r--r-- | settings.c | 14 |
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++; } |