Mercurial > hg > dmlib
comparison tools/gfxconv.c @ 853:b2140d41785a
Cleanup some parsing logic.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 23 Oct 2014 02:11:44 +0300 |
parents | f2ac9877263e |
children | ca5b4696be21 |
comparison
equal
deleted
inserted
replaced
852:ff13d79c75e0 | 853:b2140d41785a |
---|---|
421 } | 421 } |
422 | 422 |
423 | 423 |
424 BOOL dmParseMapOptionString(char *opt, void *values, int *nvalues, const int nmax, const BOOL requireIndex, const char *msg) | 424 BOOL dmParseMapOptionString(char *opt, void *values, int *nvalues, const int nmax, const BOOL requireIndex, const char *msg) |
425 { | 425 { |
426 char *end, *start = opt; | 426 char *start = opt; |
427 | 427 |
428 *nvalues = 0; | 428 *nvalues = 0; |
429 while (*nvalues < nmax && *start && (end = strchr(start, ',')) != NULL) | 429 while (*start && *nvalues < nmax) |
430 { | 430 { |
431 char *end = strchr(start, ','); | |
432 | |
431 if (!dmParseMapOptionItem(start, end, values, *nvalues, nmax, requireIndex, msg)) | 433 if (!dmParseMapOptionItem(start, end, values, *nvalues, nmax, requireIndex, msg)) |
432 return FALSE; | 434 return FALSE; |
433 | 435 |
436 (*nvalues)++; | |
437 | |
438 if (!end) | |
439 break; | |
440 | |
434 start = end + 1; | 441 start = end + 1; |
435 (*nvalues)++; | |
436 } | |
437 | |
438 if (*start && *nvalues < nmax) | |
439 { | |
440 if (!dmParseMapOptionItem(start, NULL, values, *nvalues, nmax, requireIndex, msg)) | |
441 return FALSE; | |
442 | |
443 (*nvalues)++; | |
444 } | 442 } |
445 | 443 |
446 return TRUE; | 444 return TRUE; |
447 } | 445 } |
448 | 446 |