]> granicus.if.org Git - graphviz/commitdiff
cgraph: use a C99 bool for 'maybe_num'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 21 Apr 2022 15:00:01 +0000 (08:00 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 28 Apr 2022 00:09:19 +0000 (17:09 -0700)
This makes it slightly clearer what the intent and usage of this variable is.

lib/cgraph/write.c

index 3d6f3316f5ef52cdcdddcf9e3865898012bb3ec0..e14f7d8356c1584f472757cc953f5d5a121c1766 100644 (file)
@@ -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;
            }
        }