diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2023-12-27 21:51:13 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2023-12-27 21:51:13 +0100 |
commit | 24e4859e08ccec3e81ddeb1405a10110973be565 (patch) | |
tree | a90af6383286eb6f649d000de325431f9a035a5c | |
parent | fb3a67dfbb757a005d451907b9640de02a303380 (diff) |
Reformatted GetNumberInsideParens()
-rw-r--r-- | FICS/formula.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/FICS/formula.c b/FICS/formula.c index 4315239..980f7d8 100644 --- a/FICS/formula.c +++ b/FICS/formula.c @@ -96,20 +96,27 @@ int GetRating(player *p, int gametype) else return 0; } /* end of function GetRating. */ -int GetNumberInsideParens (game *g, int clause, int *i, int *token, - int eval) +int +GetNumberInsideParens(game *g, int clause, int *i, int *token, int eval) { - char *string = GetPlayersFormula(&parray[g->black], clause); - int ret; + char *string = GetPlayersFormula(&parray[g->black], clause); + int ret; + + while (string[*i] != '\0' && isspace(string[*i])) + (*i)++; - while (string[*i] != '\0' && isspace(string[*i])) (*i)++; - if (!MoveIndexPastString(string, i, "(")) return (ERR_BADCHAR); + if (!MoveIndexPastString(string, i, "(")) + return ERR_BADCHAR; - ret = CheckFormula(g, clause, i, OPTYPE_PAREN, token, eval); - if (ret != ERR_NONE) - return (ret); - if (MoveIndexPastString(string, i, ")")) return (ERR_NONE); - else return (ERR_PAREN); + ret = CheckFormula(g, clause, i, OPTYPE_PAREN, token, eval); + + if (ret != ERR_NONE) + return ret; + + if (MoveIndexPastString(string, i, ")")) + return ERR_NONE; + else + return ERR_PAREN; } int |