]> mj.ucw.cz Git - pciutils.git/commitdiff
lib: Fix definition of strcasecmp() for PCI_OS_WINDOWS
authorPali Rohár <pali@kernel.org>
Sun, 26 Dec 2021 17:18:59 +0000 (18:18 +0100)
committerMartin Mares <mj@ucw.cz>
Tue, 28 Dec 2021 15:26:50 +0000 (16:26 +0100)
UCRT, MSVCRT and CRTDLL runtime libraries provides only _strcmpi()
function and not strcmpi().

MinGW32 has static libraries libcoldname.a and libmoldname.a which provides
strcmpi() function (as link-time redirect to _strcmpi()). libcoldname.a is
automatically linked when compiling for CRTDLL runtime and libmoldname.a
for MSVCRT runtime.

MinGW-w64 has only libmoldname.a library with strcmpi() function and it is
linked to final executable only when compiling for MSVCRT runtime.
when linking with MSVCRT.

To prevent dependency on particular linking configuration and MinGW
toolchain, use set strcasecmp() as alias to _strcmpi() function which is
provided by any runtime library.

lib/sysdep.h

index 1a5cb16c82df9b6c1a8f0ccb22db22313e0f9fdf..c6c248eac740e8c7cd11c6612f1702d7feec34eb 100644 (file)
@@ -21,7 +21,7 @@ typedef u8 byte;
 typedef u16 word;
 
 #ifdef PCI_OS_WINDOWS
-#define strcasecmp strcmpi
+#define strcasecmp _strcmpi
 #endif
 
 #ifdef PCI_HAVE_LINUX_BYTEORDER_H