]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
xz: Include <strings.h> in suffix.c if needed for strcasecmp().
authorLasse Collin <lasse.collin@tukaani.org>
Tue, 10 Jan 2023 09:23:41 +0000 (11:23 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Tue, 10 Jan 2023 09:23:41 +0000 (11:23 +0200)
SUSv2 and POSIX.1‐2017 declare only a few functions in <strings.h>.
Of these, strcasecmp() is used on some platforms in suffix.c.
Nothing else in the project needs <strings.h> (at least if
building on a modern system).

sysdefs.h currently includes <strings.h> if HAVE_STRINGS_H is
defined and suffix.c relied on this.

Note that dos/config.h doesn't #define HAVE_STRINGS_H even though
DJGPP does have strings.h. It isn't needed with DJGPP as strcasecmp()
is also in <string.h> in DJGPP.

src/xz/suffix.c

index 6bb35d4229f61fcf80b134f0a05f60c11c0ed27c..09add3817ebddd84fcb9a3acc7925889a94c04a9 100644 (file)
@@ -18,6 +18,9 @@
 
 // For case-insensitive filename suffix on case-insensitive systems
 #if defined(TUKLIB_DOSLIKE) || defined(__VMS)
+#      ifdef HAVE_STRINGS_H
+#              include <strings.h>
+#      endif
 #      define strcmp strcasecmp
 #endif