From b8b72dfeb0b1149d7c87fff5be12d69b6f3cfb2e Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Thu, 21 Apr 2022 07:57:50 -0700 Subject: [PATCH] cgraph: inline and remove 'ISALNUM' 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 | 2 -- lib/cgraph/write.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/cgraph/cghdr.h b/lib/cgraph/cghdr.h index 4f05921fc..6a5bc679c 100644 --- a/lib/cgraph/cghdr.h +++ b/lib/cgraph/cghdr.h @@ -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, diff --git a/lib/cgraph/write.c b/lib/cgraph/write.c index 4ace9882c..3d6f3316f 100644 --- a/lib/cgraph/write.c +++ b/lib/cgraph/write.c @@ -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++; -- 2.40.0