]> granicus.if.org Git - graphviz/commitdiff
gvpr parseID: simplify loop
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 3 Aug 2022 01:34:31 +0000 (18:34 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 6 Aug 2022 00:03:40 +0000 (17:03 -0700)
lib/gvpr/parse.c

index 0b64c71b6d033c6c30b0fff7d9283075e5bd6d50..32ac232384bdff37a7dc8d951c8f8dda44c4d225 100644 (file)
@@ -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';