From ff62bccb6fc5e16c5c455617687e2947c9d33958 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 29 Aug 2021 16:21:59 -0700 Subject: [PATCH] more standard usage of isdigit and friends --- cmd/lefty/dot2l/dotlex.c | 2 +- cmd/tools/colxlate.c | 16 ++-------------- lib/common/emit.c | 4 ++-- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/cmd/lefty/dot2l/dotlex.c b/cmd/lefty/dot2l/dotlex.c index a3de2431f..7e1ecfa72 100644 --- a/cmd/lefty/dot2l/dotlex.c +++ b/cmd/lefty/dot2l/dotlex.c @@ -194,7 +194,7 @@ static void error_context (void) { if (lexptr == NULL) return; fprintf (stderr, "context: "); - for (p = lexptr - 1; (p > lexbuf) && (isspace (*p) == FALSE); p--) + for (p = lexptr - 1; (p > lexbuf) && !isspace(*p); p--) ; for (q = lexbuf; q < p; q++) fputc (*q, stderr); diff --git a/cmd/tools/colxlate.c b/cmd/tools/colxlate.c index 597597fab..f1d9fbefd 100644 --- a/cmd/tools/colxlate.c +++ b/cmd/tools/colxlate.c @@ -15,18 +15,6 @@ #include #endif #include -#ifndef FALSE -#define FALSE (0) -#endif -#ifndef TRUE -#define TRUE (!FALSE) -#endif -#ifndef NOT -#define NOT(x) (!(x)) -#endif -#ifndef NIL -#define NIL(type) ((type)0) -#endif typedef struct hsbcolor_t { char *name; unsigned char h, s, b; @@ -41,7 +29,7 @@ static unsigned char *canoncolor(char *orig, unsigned char *out) unsigned char c; unsigned char *p = out; while ((c = *(unsigned char *) orig++)) { - if (isalnum(c) == FALSE) + if (!isalnum(c)) continue; if (isupper(c)) c = tolower(c); @@ -71,7 +59,7 @@ char *colorxlate(char *str, char *buf) sizeof(fake), colorcmpf); } if (last == NULL) { - if (isdigit(canon[0]) == FALSE) { + if (!isdigit(canon[0])) { fprintf(stderr, "warning: %s is not a known color\n", str); strcpy(buf, str); } else diff --git a/lib/common/emit.c b/lib/common/emit.c index b19b5664e..2ac343c7a 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -1014,7 +1014,7 @@ static boolean is_natural_number(char *sstr) unsigned char *str = (unsigned char *) sstr; while (*str) - if (NOT(isdigit(*str++))) + if (!isdigit(*str++)) return FALSE; return TRUE; } @@ -1999,7 +1999,7 @@ static void emit_attachment(GVJ_t * job, textlabel_t * lp, splines * spl) unsigned char *s; for (s = (unsigned char *) (lp->text); *s; s++) { - if (isspace(*s) == FALSE) + if (!isspace(*s)) break; } if (*s == 0) -- 2.40.0