From: Matthew Fernandez Date: Thu, 21 Apr 2022 15:00:01 +0000 (-0700) Subject: cgraph: use a C99 bool for 'maybe_num' X-Git-Tag: 4.0.0~63^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3768b69ac764ce52bf996d5964754498960ddaf3;p=graphviz cgraph: use a C99 bool for 'maybe_num' This makes it slightly clearer what the intent and usage of this variable is. --- diff --git a/lib/cgraph/write.c b/lib/cgraph/write.c index 3d6f3316f..e14f7d835 100644 --- a/lib/cgraph/write.c +++ b/lib/cgraph/write.c @@ -60,7 +60,7 @@ static char *_agstrcanon(char *arg, char *buf) char uc; int cnt = 0, dotcnt = 0; bool needs_quotes = false; - int maybe_num; + bool maybe_num; bool backslash_pending = false; static const char *tokenlist[] /* must agree with scan.l */ = { "node", "edge", "strict", "graph", "digraph", "subgraph", @@ -74,7 +74,7 @@ static char *_agstrcanon(char *arg, char *buf) p = buf; *p++ = '\"'; uc = *s++; - maybe_num = isdigit(uc) || uc == '.' || uc == '-'; + maybe_num = isdigit(uc) != 0 || uc == '.' || uc == '-'; while (uc) { if (uc == '\"') { *p++ = '\\'; @@ -83,18 +83,18 @@ static char *_agstrcanon(char *arg, char *buf) else if (maybe_num) { if (uc == '-') { if (cnt) { - maybe_num = FALSE; + maybe_num = false; needs_quotes = true; } } else if (uc == '.') { if (dotcnt++) { - maybe_num = FALSE; + maybe_num = false; needs_quotes = true; } } else if (!isdigit(uc)) { - maybe_num = FALSE; + maybe_num = false; needs_quotes = true; } }