From: Matthew Fernandez Date: Sun, 4 Jul 2021 04:31:39 +0000 (-0700) Subject: rewrite is_id_char macro as a function X-Git-Tag: 2.49.0~58^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=817700675dbe88878080a41890246964450c062a;p=graphviz rewrite is_id_char macro as a function There is no need for this to be a macro. Making it a function allows stronger type safety, safe to use with impure arguments, and reduces bracketing noise. --- diff --git a/lib/cgraph/write.c b/lib/cgraph/write.c index 454922b92..44b009bc4 100644 --- a/lib/cgraph/write.c +++ b/lib/cgraph/write.c @@ -44,8 +44,10 @@ static int indent(Agraph_t * g, iochan_t * ofile) return 0; } - /* alphanumeric, '.', '-', or non-ascii; basically, chars used in unquoted ids */ -#define is_id_char(c) (isalnum(c) || ((c) == '.') || ((c) == '-') || !isascii(c)) +// alphanumeric, '.', '-', or non-ascii; basically, chars used in unquoted ids +static bool is_id_char(char c) { + return isalnum(c) || c == '.' || c == '-' || !isascii(c); +} /* _agstrcanon: * Canonicalize ordinary strings.