clarify some parsing code that valgrind complains about.

This commit is contained in:
Enno Rehling 2014-12-28 22:07:53 +01:00
parent 975b930f44
commit 335f37a9ec
1 changed files with 3 additions and 15 deletions

View File

@ -274,20 +274,8 @@ int readorders(const char *filename)
const char *s; const char *s;
init_tokens_str(b); init_tokens_str(b);
s = gettoken(token, sizeof(token)); s = gettoken(token, sizeof(token));
p = s ? findparam(s, lang) : NOPARAM; p = (s && s[0] != '@') ? findparam(s, lang) : NOPARAM;
switch (p) { 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_GAMENAME:
case P_FACTION: case P_FACTION:
f = factionorders(); f = factionorders();
@ -311,8 +299,8 @@ int readorders(const char *filename)
break; break;
} }
init_tokens_str(b); init_tokens_str(b);
b = getstrtoken(); s = gettoken(token, sizeof(token));
p = (!b || b[0] == '@') ? NOPARAM : findparam(b, lang); p = (s && s[0] != '@') ? findparam(s, lang) : NOPARAM;
} while ((p != P_UNIT || !f) && p != P_FACTION && p != P_NEXT } while ((p != P_UNIT || !f) && p != P_FACTION && p != P_NEXT
&& p != P_GAMENAME); && p != P_GAMENAME);
break; break;