* makeint.h (streq, patheq): Avoid pointer comparisons

Some compilers will warn about this and I doubt it provides much
benefit.
This commit is contained in:
Paul Smith 2025-08-21 08:17:24 -04:00
parent 77164d9739
commit 63961d5d09

View File

@ -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