# HG changeset patch # User Matti Hamalainen # Date 1414019504 -10800 # Node ID b2140d41785a7676208ee35c6a898b9f471566cf # Parent ff13d79c75e0d017fbd82b763e44a60d5be9680e Cleanup some parsing logic. diff -r ff13d79c75e0 -r b2140d41785a tools/gfxconv.c --- a/tools/gfxconv.c Thu Oct 23 02:09:52 2014 +0300 +++ b/tools/gfxconv.c Thu Oct 23 02:11:44 2014 +0300 @@ -423,24 +423,22 @@ BOOL dmParseMapOptionString(char *opt, void *values, int *nvalues, const int nmax, const BOOL requireIndex, const char *msg) { - char *end, *start = opt; + char *start = opt; *nvalues = 0; - while (*nvalues < nmax && *start && (end = strchr(start, ',')) != NULL) + while (*start && *nvalues < nmax) { + char *end = strchr(start, ','); + if (!dmParseMapOptionItem(start, end, values, *nvalues, nmax, requireIndex, msg)) return FALSE; + (*nvalues)++; + + if (!end) + break; + start = end + 1; - (*nvalues)++; - } - - if (*start && *nvalues < nmax) - { - if (!dmParseMapOptionItem(start, NULL, values, *nvalues, nmax, requireIndex, msg)) - return FALSE; - - (*nvalues)++; } return TRUE;