From 24e4859e08ccec3e81ddeb1405a10110973be565 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Wed, 27 Dec 2023 21:51:13 +0100 Subject: Reformatted GetNumberInsideParens() --- FICS/formula.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'FICS/formula.c') 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 -- cgit v1.2.3