Revert "add string comparison functions"

This reverts commit 121f189a7a.
Equivalent functions already exist in strings.{c,h}
master
Mark Nunberg 7 years ago
parent 441fe3e18d
commit a5da889d0e

@ -6,7 +6,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <limits.h> #include <limits.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include <redismodule.h> #include <redismodule.h>
#include "util.h" #include "util.h"
@ -41,7 +40,7 @@ int RMUtil_ArgIndex(const char *arg, RedisModuleString **argv, int argc) {
if (l != larg) continue; if (l != larg) continue;
if (carg != NULL && strncasecmp(carg, arg, larg) == 0) { if (carg != NULL && strncasecmp(carg, arg, larg) == 0) {
return offset; return offset;
} \ }
} }
return -1; return -1;
} }
@ -244,17 +243,4 @@ int RedisModule_TryGetValue(RedisModuleKey *key, const RedisModuleType *type, vo
} else { } else {
return RMUTIL_VALUE_MISMATCH; return RMUTIL_VALUE_MISMATCH;
} }
}
int RedisModule_Strncasecmp(const RedisModuleString *rs1, const char *s2, size_t n) {
size_t n2;
const char *s1 = RedisModule_StringPtrLen(rs1, &n2);
if (n != n2) {
return -1;
}
return strncasecmp(s1, s2, n);
}
int RedisModule_Strcasecmp(const RedisModuleString *s1, const char *s2) {
return RedisModule_Strncasecmp(s1, s2, strlen(s2));
} }

@ -130,19 +130,4 @@ typedef enum {
*/ */
int RedisModule_TryGetValue(RedisModuleKey *key, const RedisModuleType *type, void **out); int RedisModule_TryGetValue(RedisModuleKey *key, const RedisModuleType *type, void **out);
/**
* Compares a RedisModuleString against an actual string buffer, avoiding
* keeping a temporary value for RedisModule_StringPtrLen.
* @param s1 the RedisModuleString
* @param s2 the buffer
* @param n the length of the C string.
* Returns 0 if the strings are equal.
*/
int RedisModule_Strncasecmp(const RedisModuleString *s1, const char *s2, size_t n);
/**
* Exactly like RedisModule_Strncasecmp, except that `s2` is NUL-terminated
*/
int RedisModule_Strcasecmp(const RedisModuleString *s, const char *s2);
#endif #endif

Loading…
Cancel
Save