From: Matthew Fernandez Date: Wed, 3 Aug 2022 01:34:31 +0000 (-0700) Subject: gvpr parseID: simplify loop X-Git-Tag: 5.0.1~20^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=922e07688e0660366ef5c850cc0100b22e73742d;p=graphviz gvpr parseID: simplify loop --- diff --git a/lib/gvpr/parse.c b/lib/gvpr/parse.c index 0b64c71b6..32ac23238 100644 --- a/lib/gvpr/parse.c +++ b/lib/gvpr/parse.c @@ -165,23 +165,21 @@ static int skipWS(Sfio_t * str) */ static void parseID(Sfio_t * str, int c, char *buf, size_t bsize) { - bool more = true; char *ptr = buf; char *eptr = buf + (bsize - 1); *ptr++ = c; - while (more) { + while (true) { c = readc(str, 0); if (c < 0) - more = false; + break; if (isalpha(c) || c == '_') { if (ptr == eptr) - more = false; - else - *ptr++ = c; + break; + *ptr++ = c; } else { - more = false; unreadc(str, c); + break; } } *ptr = '\0';