diff options
Diffstat (limited to 'crypto/openssl/crypto/o_str.c')
-rw-r--r-- | crypto/openssl/crypto/o_str.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/crypto/openssl/crypto/o_str.c b/crypto/openssl/crypto/o_str.c index 7189d13..2db0993 100644 --- a/crypto/openssl/crypto/o_str.c +++ b/crypto/openssl/crypto/o_str.c @@ -57,20 +57,12 @@ */ #include <ctype.h> -#include <openssl/e_os2.h> -#ifdef OPENSSL_SYS_WINDOWS -# include <string.h> -#else -# include <strings.h> -#endif +#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); @@ -86,20 +78,28 @@ 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 } +int OPENSSL_memcmp(const void *v1,const void *v2,size_t n) + { + const unsigned char *c1=v1,*c2=v2; + int ret=0; + + while(n && (ret=*c1-*c2)==0) n--,c1++,c2++; + + return ret; + } |