From 922e07688e0660366ef5c850cc0100b22e73742d Mon Sep 17 00:00:00 2001 From: Matthew Fernandez <matthew.fernandez@gmail.com> Date: Tue, 2 Aug 2022 18:34:31 -0700 Subject: [PATCH] gvpr parseID: simplify loop --- lib/gvpr/parse.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) 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'; -- 2.40.0