summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2005-01-13 15:46:09 +0000
committerAndy Polyakov <appro@openssl.org>2005-01-13 15:46:09 +0000
commite6d27baf5277eeec8f30c2edce52b8baabebb574 (patch)
tree7629b6e382e8aac083da6d693905065d532a07c5
parente7e1150706f8c8bcc807d8184bd0ebd08b6f5aff (diff)
downloadopenssl-new-e6d27baf5277eeec8f30c2edce52b8baabebb574.tar.gz
Rely on e_os.h to appropriately define str[n]casecmp in non-POSIX
environments.
-rw-r--r--crypto/o_str.c14
-rw-r--r--e_os.h1
2 files changed, 6 insertions, 9 deletions
diff --git a/crypto/o_str.c b/crypto/o_str.c
index 5a78f32509..da8860491d 100644
--- a/crypto/o_str.c
+++ b/crypto/o_str.c
@@ -60,12 +60,9 @@
#include <e_os.h>
#include "o_str.h"
-#undef strncasecmp
-#undef strcasecmp
-
int OPENSSL_strncasecmp(const char *str1, const char *str2, size_t n)
{
-#if defined(OPENSSL_SYS_VMS)
+#if defined(OPENSSL_IMPLEMENTS_strncasecmp)
while (*str1 && *str2 && n)
{
int res = toupper(*str1) - toupper(*str2);
@@ -81,18 +78,17 @@ int OPENSSL_strncasecmp(const char *str1, const char *str2, size_t n)
if (*str2)
return -1;
return 0;
-#elif defined(OPENSSL_SYS_WINDOWS)
- return _strnicmp(str1, str2, n);
#else
+ /* Recursion hazard warning! Whenever strncasecmp is #defined as
+ * OPENSSL_strncasecmp, OPENSSL_IMPLEMENTS_strncasecmp must be
+ * defined as well. */
return strncasecmp(str1, str2, n);
#endif
}
int OPENSSL_strcasecmp(const char *str1, const char *str2)
{
-#if defined(OPENSSL_SYS_VMS)
+#if defined(OPENSSL_IMPLEMENTS_strncasecmp)
return OPENSSL_strncasecmp(str1, str2, (size_t)-1);
-#elif defined(OPENSSL_SYS_WINDOWS)
- return _stricmp(str1, str2);
#else
return strcasecmp(str1, str2);
#endif
diff --git a/e_os.h b/e_os.h
index 79f76ca109..3ff9f3cd1c 100644
--- a/e_os.h
+++ b/e_os.h
@@ -556,6 +556,7 @@ extern char *sys_errlist[]; extern int sys_nerr;
# include "o_str.h"
# define strcasecmp OPENSSL_strcasecmp
# define strncasecmp OPENSSL_strncasecmp
+# define OPENSSL_IMPLEMENTS_strncasecmp
#elif defined(OPENSSL_SYS_OS2) && defined(__EMX__)
# define strcasecmp stricmp
# define strncasecmp strnicmp