]> git.saurik.com Git - wxWidgets.git/commitdiff
Just forward Stricmp() in wx/string.h to wxCRT_StricmpA().
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 17 Jul 2013 17:27:20 +0000 (17:27 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 17 Jul 2013 17:27:20 +0000 (17:27 +0000)
Don't redo the tests already done in wx/wxcrtbase.h in wx/string.h too,
especially as they were not done correctly there (they didn't take into
account the case of MinGW in strict ANSI mode). Just call wxCRT_StricmpA().

This also allows us to get rid of HAVE_STRCASECMP_IN_STRING[S]_H tests in
configure.

Closes #15349.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74571 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

configure
configure.in
include/wx/android/config_android.h
include/wx/osx/config_xcode.h
include/wx/string.h
include/wx/wxcrtbase.h
setup.h.in
setup.h_vms

index 7dea45934a70c3bf6c48a6aae743637065c225b1..6d852842338abde2bd62006181deaa4ce7f51aa9 100755 (executable)
--- a/configure
+++ b/configure
@@ -19934,89 +19934,6 @@ $as_echo "$as_me: WARNING: Building DLLs requires OMF mode, enabled" >&2;}
         wxUSE_OMF=yes
         enable_omf=yes
       fi
-        ;;
-  *)
-
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strcasecmp() in string.h" >&5
-$as_echo_n "checking for strcasecmp() in string.h... " >&6; }
-if ${ac_cv_string_strcasecmp+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-              #include <string.h>
-
-int
-main ()
-{
-
-                  strcasecmp("foo", "bar");
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_string_strcasecmp=yes
-else
-  ac_cv_string_strcasecmp=no
-
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_string_strcasecmp" >&5
-$as_echo "$ac_cv_string_strcasecmp" >&6; }
-
-      if test x"$ac_cv_string_strcasecmp" = "xyes"; then
-          $as_echo "#define HAVE_STRCASECMP_IN_STRING_H 1" >>confdefs.h
-
-      else
-          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strcasecmp() in strings.h" >&5
-$as_echo_n "checking for strcasecmp() in strings.h... " >&6; }
-if ${ac_cv_strings_strcasecmp+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-              cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-                  #include <strings.h>
-
-int
-main ()
-{
-
-                      strcasecmp("foo", "bar");
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_strings_strcasecmp=yes
-else
-  ac_cv_strings_strcasecmp=no
-
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_strings_strcasecmp" >&5
-$as_echo "$ac_cv_strings_strcasecmp" >&6; }
-
-          if test x"$ac_cv_strings_strcasecmp" = "xyes"; then
-              $as_echo "#define HAVE_STRCASECMP_IN_STRINGS_H 1" >>confdefs.h
-
-          else
-              as_fn_error $? "No case-insensitive string comparison function found." "$LINENO" 5
-          fi
-      fi
-
         ;;
 esac
 
index b6d30fa16b12e23ec44f5e81092d21cb4e8f9ad3..b49988536d0064662d30aa70d7e15f5eea886443 100644 (file)
@@ -1519,50 +1519,6 @@ case "${host}" in
       fi
       dnl (end of OS/2-only piece)
   ;;
-  *)
-      dnl ---------------------------------------------------------------------
-      dnl look for strcasecmp() in string.h and then strings.h if it's not
-      dnl there. Don't do this on OS/2, where "stricmp" is the function to be
-      dnl used.
-      dnl ---------------------------------------------------------------------
-      dnl (non-OS/2-only piece)
-
-      AC_CACHE_CHECK([for strcasecmp() in string.h], ac_cv_string_strcasecmp, [
-          AC_TRY_LINK([
-              #include <string.h>
-              ],
-              [
-                  strcasecmp("foo", "bar");
-              ],
-              ac_cv_string_strcasecmp=yes,
-              ac_cv_string_strcasecmp=no
-          )
-      ])
-
-      if test x"$ac_cv_string_strcasecmp" = "xyes"; then
-          AC_DEFINE(HAVE_STRCASECMP_IN_STRING_H)
-      else
-          AC_CACHE_CHECK([for strcasecmp() in strings.h], ac_cv_strings_strcasecmp, [
-              AC_TRY_LINK([
-                  #include <strings.h>
-                  ],
-                  [
-                      strcasecmp("foo", "bar");
-                  ],
-                  ac_cv_strings_strcasecmp=yes,
-                  ac_cv_strings_strcasecmp=no
-              )
-          ])
-
-          if test x"$ac_cv_strings_strcasecmp" = "xyes"; then
-              AC_DEFINE(HAVE_STRCASECMP_IN_STRINGS_H)
-          else
-              AC_MSG_ERROR([No case-insensitive string comparison function found.])
-          fi
-      fi
-
-      dnl (end of non-OS/2-only piece)
-  ;;
 esac
 
 dnl ------------------------------------------------------------------------
index cd3ad55f7f7f34d3f1816e9ecfeed3ed04b7ffc4..e94d09360f7d6c531d11f0e492d13b9dc9945610 100644 (file)
@@ -31,7 +31,6 @@
 #define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
 #define HAVE_THREAD_PRIORITY_FUNCTIONS 1
 #define HAVE_SSIZE_T 1
-#define HAVE_STRCASECMP_IN_STRING_H 1
 #define HAVE_WPRINTF 1
 
 #define SIZEOF_INT 4
index 0174f32707e03bb3956b21ec35d3f5e4f7734856..c52658f10df4dbe8286a3e84f403772c6409738f 100644 (file)
 #define HAVE_LANGINFO_H 1
 #define HAVE_WCSRTOMBS 1
 #define HAVE_FPUTWS 1
-#define HAVE_STRCASECMP_IN_STRING_H 1
 #define HAVE_WPRINTF 1
 #define HAVE_VSWPRINTF 1
 #define HAVE_VSWSCANF 1
index ad47cd2fbcf9c62ad88a183468b51eb4e94167f4..60ea2c46f6dfe9a13a44b0054fba875acb2ed0c1 100644 (file)
 #  include <stdlib.h>
 #endif
 
-#ifdef HAVE_STRCASECMP_IN_STRINGS_H
-    #include <strings.h>    // for strcasecmp()
-#endif // HAVE_STRCASECMP_IN_STRINGS_H
-
 #include "wx/wxcrtbase.h"   // for wxChar, wxStrlen() etc.
 #include "wx/strvararg.h"
 #include "wx/buffer.h"      // for wxCharBuffer
@@ -145,50 +141,7 @@ inline size_t Strlen(const char *psz)
 // portable strcasecmp/_stricmp
 wxDEPRECATED( inline int Stricmp(const char *psz1, const char *psz2) );
 inline int Stricmp(const char *psz1, const char *psz2)
-{
-#if defined(__VISUALC__) && defined(__WXWINCE__)
-  register char c1, c2;
-  do {
-    c1 = tolower(*psz1++);
-    c2 = tolower(*psz2++);
-  } while ( c1 && (c1 == c2) );
-
-  return c1 - c2;
-#elif defined(__VISUALC__)
-  return _stricmp(psz1, psz2);
-#elif defined(__SC__)
-  return _stricmp(psz1, psz2);
-#elif defined(__BORLANDC__)
-  return stricmp(psz1, psz2);
-#elif defined(__WATCOMC__)
-  return stricmp(psz1, psz2);
-#elif defined(__DJGPP__)
-  return stricmp(psz1, psz2);
-#elif defined(__EMX__)
-  return stricmp(psz1, psz2);
-#elif defined(__WXPM__)
-  return stricmp(psz1, psz2);
-#elif defined(HAVE_STRCASECMP_IN_STRING_H) || \
-      defined(HAVE_STRCASECMP_IN_STRINGS_H) || \
-      defined(__GNUWIN32__)
-  return strcasecmp(psz1, psz2);
-#else
-  // almost all compilers/libraries provide this function (unfortunately under
-  // different names), that's why we don't implement our own which will surely
-  // be more efficient than this code (uncomment to use):
-  /*
-    register char c1, c2;
-    do {
-      c1 = tolower(*psz1++);
-      c2 = tolower(*psz2++);
-    } while ( c1 && (c1 == c2) );
-
-    return c1 - c2;
-  */
-
-  #error  "Please define string case-insensitive compare for your OS/compiler"
-#endif  // OS/compiler
-}
+    { return wxCRT_StricmpA(psz1, psz2); }
 
 #endif // WXWIN_COMPATIBILITY_2_8
 
index c1269805337d8eed0c12d10d9d91543eef63b5ee..0b73c33a2e856b56368a5d9bc196df609b9eb2a7 100644 (file)
@@ -249,7 +249,7 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size );
         defined(__EMX__) || defined(__DJGPP__)
     #define wxCRT_StricmpA stricmp
     #define wxCRT_StrnicmpA strnicmp
-#elif defined(__SYMANTEC__) || defined(__VISUALC__)
+#elif defined(__SYMANTEC__) || (defined(__VISUALC__) && !defined(__WXWINCE__))
     #define wxCRT_StricmpA _stricmp
     #define wxCRT_StrnicmpA _strnicmp
 #elif defined(__UNIX__) || (defined(__GNUWIN32__) && !defined(__WX_STRICT_ANSI_GCC__))
index b5cc4e1eee526677c2aa41c54061f97736cbe59a..f46b3bcca57ae0df0139019f885cc3e2566ed7d8 100644 (file)
 /* Define this if you have fputws() */
 #undef HAVE_FPUTWS
 
-/* Define this if you have strcasecmp() function in <string.h> */
-#undef HAVE_STRCASECMP_IN_STRING_H
-
-/* Define this if you have strcasecmp() function in <strings.h> */
-#undef HAVE_STRCASECMP_IN_STRINGS_H
-
 /* Define this if you have wprintf() and related functions */
 #undef HAVE_WPRINTF
 
index 79676b277fef54147a23ab41b3c8b134a3f12862..63c40eefa6e3d9ddd28c649532b5cedff509702e 100644 (file)
@@ -1319,12 +1319,6 @@ typedef pid_t GPid;
 /* Define this if you have fputws() */
 #define HAVE_FPUTWS 1
 
-/* Define this if you have strcasecmp() function in <string.h> */
-#define HAVE_STRCASECMP_IN_STRING_H 1
-
-/* Define this if you have strcasecmp() function in <strings.h> */
-#undef HAVE_STRCASECMP_IN_STRINGS_H
-
 /* Define this if you have wprintf() and related functions */
 #define HAVE_WPRINTF 1