From 63961d5d0905f69c59b44652fd33ac932f7d1c23 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Thu, 21 Aug 2025 08:17:24 -0400 Subject: [PATCH] * makeint.h (streq, patheq): Avoid pointer comparisons Some compilers will warn about this and I doubt it provides much benefit. --- src/makeint.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/makeint.h b/src/makeint.h index 61c78229..120fc915 100644 --- a/src/makeint.h +++ b/src/makeint.h @@ -320,18 +320,13 @@ extern mode_t umask (mode_t); #define ISDIGIT(c) ((unsigned) (c) - '0' <= 9) /* Test if two strings are equal. Is this worthwhile? Should be profiled. */ -#define streq(a, b) \ - ((a) == (b) || \ - (*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1)))) +#define streq(a, b) (*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))) /* Test if two strings are equal, but match case-insensitively on systems which have case-insensitive filesystems. Should only be used for filenames! */ #ifdef HAVE_CASE_INSENSITIVE_FS -# define patheq(a, b) \ - ((a) == (b) \ - || (tolower((unsigned char)*(a)) == tolower((unsigned char)*(b)) \ - && (*(a) == '\0' || !strcasecmp ((a) + 1, (b) + 1)))) +# define patheq(a, b) (strcasecmp ((a), (b)) == 0) #else # define patheq(a, b) streq(a, b) #endif -- 2.47.3