optimize the number of failed findparam calls a little bit

This commit is contained in:
Enno Rehling 2012-05-16 09:24:12 +02:00
parent 21a49b1660
commit bfad64695c
1 changed files with 15 additions and 10 deletions

View File

@ -377,6 +377,7 @@ boolean is_repeated(const order * ord)
{ {
keyword_t kwd = ORD_KEYWORD(ord); keyword_t kwd = ORD_KEYWORD(ord);
const struct locale *lang = ORD_LOCALE(ord); const struct locale *lang = ORD_LOCALE(ord);
const char * s;
param_t param; param_t param;
switch (kwd) { switch (kwd) {
@ -405,11 +406,14 @@ boolean is_repeated(const order * ord)
parser_pushstate(); parser_pushstate();
init_tokens(ord); init_tokens(ord);
skip_token(); skip_token();
param = getparam(lang); s = getstrtoken();
if (s[0]>'9') {
param = findparam(s, lang);
parser_popstate(); parser_popstate();
if (param == P_SHIP) {
if (param == P_SHIP)
return true; return true;
}
}
break; break;
case K_MAKE: case K_MAKE:
@ -421,11 +425,12 @@ boolean is_repeated(const order * ord)
parser_pushstate(); parser_pushstate();
init_tokens(ord); /* initialize token-parser */ init_tokens(ord); /* initialize token-parser */
skip_token(); skip_token();
param = getparam(lang); s = getstrtoken();
if (s[0]>'9') {
param = findparam(s, lang);
parser_popstate(); parser_popstate();
return param != P_TEMP;
if (param != P_TEMP) }
return true;
break; break;
default: default:
return false; return false;