mirror of
https://github.com/curl/curl.git
synced 2026-07-24 17:07:16 +03:00
src: add CURL_STRICMP() macro, use _stricmp() on Windows
Add `CURL_STRICMP()` macro that works on all platforms depending on which lib C function is available. Make sure to always use `_stricmp()` on Windows, which is the non-deprecated, official API for this on this platform. Before this patch it used a MinGW-specific call, or a deprecated compatibility wrapper with MSVC. Drop `stricmp` variant detections on Windows with autotools. https://learn.microsoft.com/cpp/c-runtime-library/reference/stricmp-wcsicmp-mbsicmp-stricmp-l-wcsicmp-l-mbsicmp-l Ref: #15652 Closes #15788
This commit is contained in:
parent
68bd759c2b
commit
6dacd2f208
7 changed files with 28 additions and 37 deletions
|
|
@ -66,6 +66,21 @@ extern FILE *tool_stderr;
|
|||
# include "tool_strdup.h"
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
# define CURL_STRICMP(p1, p2) _stricmp(p1, p2)
|
||||
#elif defined(HAVE_STRCASECMP)
|
||||
# ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
# endif
|
||||
# define CURL_STRICMP(p1, p2) strcasecmp(p1, p2)
|
||||
#elif defined(HAVE_STRCMPI)
|
||||
# define CURL_STRICMP(p1, p2) strcmpi(p1, p2)
|
||||
#elif defined(HAVE_STRICMP)
|
||||
# define CURL_STRICMP(p1, p2) stricmp(p1, p2)
|
||||
#else
|
||||
# define CURL_STRICMP(p1, p2) strcmp(p1, p2)
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
/* set in win32_init() */
|
||||
extern LARGE_INTEGER tool_freq;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue