From 335f37a9ecc066a59f16deea9cc8bdb8dc04c0e8 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 28 Dec 2014 22:07:53 +0100 Subject: [PATCH] clarify some parsing code that valgrind complains about. --- src/kernel/save.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/kernel/save.c b/src/kernel/save.c index 59040cba0..ca776aff9 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -274,20 +274,8 @@ int readorders(const char *filename) const char *s; init_tokens_str(b); s = gettoken(token, sizeof(token)); - p = s ? findparam(s, lang) : NOPARAM; + p = (s && s[0] != '@') ? findparam(s, lang) : NOPARAM; switch (p) { -#undef LOCALE_CHANGE -#ifdef LOCALE_CHANGE - case P_LOCALE: - { - const char *s = getstrtoken(); - if (f && get_locale(s)) { - f->locale = get_locale(s); - } - } - b = getbuf(F, enc_gamedata); - break; -#endif case P_GAMENAME: case P_FACTION: f = factionorders(); @@ -311,8 +299,8 @@ int readorders(const char *filename) break; } init_tokens_str(b); - b = getstrtoken(); - p = (!b || b[0] == '@') ? NOPARAM : findparam(b, lang); + s = gettoken(token, sizeof(token)); + p = (s && s[0] != '@') ? findparam(s, lang) : NOPARAM; } while ((p != P_UNIT || !f) && p != P_FACTION && p != P_NEXT && p != P_GAMENAME); break;