|
|
|
@ -3,7 +3,6 @@
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
#include "strings.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "sds.h"
|
|
|
|
|
|
|
|
|
|
// RedisModuleString *RMUtil_CreateFormattedString(RedisModuleCtx *ctx, const char *fmt, ...) {
|
|
|
|
@ -21,7 +20,6 @@
|
|
|
|
|
|
|
|
|
|
int RMUtil_StringEquals(RedisModuleString *s1, RedisModuleString *s2) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char *c1, *c2;
|
|
|
|
|
size_t l1, l2;
|
|
|
|
|
c1 = RedisModule_StringPtrLen(s1, &l1);
|
|
|
|
@ -33,7 +31,6 @@ int RMUtil_StringEquals(RedisModuleString *s1, RedisModuleString *s2) {
|
|
|
|
|
|
|
|
|
|
int RMUtil_StringEqualsC(RedisModuleString *s1, const char *s2) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char *c1;
|
|
|
|
|
size_t l1, l2 = strlen(s2);
|
|
|
|
|
c1 = RedisModule_StringPtrLen(s1, &l1);
|
|
|
|
@ -41,6 +38,15 @@ int RMUtil_StringEqualsC(RedisModuleString *s1, const char *s2) {
|
|
|
|
|
|
|
|
|
|
return strncmp(c1, s2, l1) == 0;
|
|
|
|
|
}
|
|
|
|
|
int RMUtil_StringEqualsCaseC(RedisModuleString *s1, const char *s2) {
|
|
|
|
|
|
|
|
|
|
const char *c1;
|
|
|
|
|
size_t l1, l2 = strlen(s2);
|
|
|
|
|
c1 = RedisModule_StringPtrLen(s1, &l1);
|
|
|
|
|
if (l1 != l2) return 0;
|
|
|
|
|
|
|
|
|
|
return strncasecmp(c1, s2, l1) == 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RMUtil_StringToLower(RedisModuleString *s) {
|
|
|
|
|
|
|
|
|
@ -51,7 +57,6 @@ void RMUtil_StringToLower(RedisModuleString *s) {
|
|
|
|
|
*c = tolower(*c);
|
|
|
|
|
++c;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RMUtil_StringToUpper(RedisModuleString *s) {
|
|
|
|
@ -62,6 +67,4 @@ void RMUtil_StringToUpper(RedisModuleString *s) {
|
|
|
|
|
*c = toupper(*c);
|
|
|
|
|
++c;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|