Expr: convert Json bool to 1/0 numerical type.

This commit is contained in:
antirez
2025-02-28 17:49:09 +01:00
parent 2d311dbb01
commit 89ef4c0702
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ all: vset.so
.c.xo:
$(CC) -I. $(CFLAGS) $(SHOBJ_CFLAGS) -fPIC -c $< -o $@
vset.xo: redismodule.h
vset.xo: redismodule.h expr.c
vset.so: vset.xo hnsw.xo cJSON.xo
$(CC) -o $@ $^ $(SHOBJ_LDFLAGS) $(LIBS) -lc
+4
View File
@@ -715,6 +715,10 @@ exprtoken *exprJsonToToken(cJSON *js) {
obj->str.start = obj->str.heapstr;
obj->str.len = strlen(obj->str.heapstr);
return obj;
} else if (cJSON_IsBool(js)) {
exprtoken *obj = exprNewToken(EXPR_TOKEN_NUM);
obj->num = cJSON_IsTrue(js);
return obj;
} else if (cJSON_IsArray(js)) {
// First, scan the array to ensure it only
// contains strings and numbers. Otherwise the