cURL / Mailing Lists / curl-library / Single Mail

curl-library

strequal.c patch

From: Andy Cedilnik <andy.cedilnik_at_kitware.com>
Date: 28 Mar 2003 13:15:14 -0500

Hi,

There is a problem with preprocessor logic in strequal.c. Here it goes.
On Windows there is strcmpi, so the answer to HAVE_STRCMPI is 1. However
there is no strncmpi, so the whole thing fails. This patch fixes this
problem by looking for stricmp (HAVE_STRICMP) first, and since both
stricmp and strnicmp are defined, this will work.

Thanks.

                        Andy

Index: lib/strequal.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/strequal.c,v
retrieving revision 1.22
diff -u -r1.22 strequal.c
--- lib/strequal.c 29 Jan 2003 10:14:24 -0000 1.22
+++ lib/strequal.c 28 Mar 2003 18:10:10 -0000
@@ -30,10 +30,10 @@
 {
 #if defined(HAVE_STRCASECMP)
   return !(strcasecmp)(first, second);
-#elif defined(HAVE_STRCMPI)
- return !(strcmpi)(first, second);
 #elif defined(HAVE_STRICMP)
   return !(stricmp)(first, second);
+#elif defined(HAVE_STRCMPI)
+ return !(strcmpi)(first, second);
 #else
   while (*first && *second) {
     if (toupper(*first) != toupper(*second)) {
@@ -50,10 +50,10 @@
 {
 #if defined(HAVE_STRCASECMP)
   return !strncasecmp(first, second, max);
-#elif defined(HAVE_STRCMPI)
- return !strncmpi(first, second, max);
 #elif defined(HAVE_STRICMP)
   return !strnicmp(first, second, max);
+#elif defined(HAVE_STRCMPI)
+ return !strncmpi(first, second, max);
 #else
   while (*first && *second && max) {
     if (toupper(*first) != toupper(*second)) {

-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en
Received on 2003-03-28