]> granicus.if.org Git - graphviz/commitdiff
cgraph: inline and remove 'ISALNUM'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 21 Apr 2022 14:57:50 +0000 (07:57 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 28 Apr 2022 00:09:19 +0000 (17:09 -0700)
It does not seem worth maintaining this abstraction for a single usage.
Especially when the surrounding code directly calls numerous other ctype.h
functions.

lib/cgraph/cghdr.h
lib/cgraph/write.c

index 4f05921fc41eedc98a7372ceaeff7eb85ae4fcb0..6a5bc679c825868b565b9602073229e65c0031f1 100644 (file)
@@ -47,8 +47,6 @@ static inline bool streq(const char *a, const char *b) {
 #define AGCLOS(g,d)                    ((g)->clos->state.d)
 #define AGNEW(g,t)                     ((t*)(agalloc(g,sizeof(t))))
 
-#define ISALNUM(c) ((isalnum(c)) || ((c) == '_') || (!isascii(c)))
-
        /* functional definitions */
 typedef Agobj_t *(*agobjsearchfn_t) (Agraph_t * g, Agobj_t * obj);
 CGHDR_API int agapply(Agraph_t * g, Agobj_t * obj, agobjfn_t fn, void *arg,
index 4ace9882c56bb3a45c7645c3b8816504c5d358fe..3d6f3316f5ef52cdcdddcf9e3865898012bb3ec0 100644 (file)
@@ -98,7 +98,7 @@ static char *_agstrcanon(char *arg, char *buf)
                needs_quotes = true;
            }
        }
-       else if (!ISALNUM(uc))
+       else if (!(isalnum(uc) || uc == '_' || !isascii(uc)))
            needs_quotes = true;
        *p++ = uc;
        uc = *s++;