]> git.saurik.com Git - redis.git/blobdiff - src/object.c
Add function to create ziplist-backed sorted set
[redis.git] / src / object.c
index e6b02da8ea5747f42708d83f0381b65b98e8aa0e..a6bf8a20560cadf0ab651f73b6c4c1285f502bff 100644 (file)
@@ -93,12 +93,18 @@ robj *createHashObject(void) {
 
 robj *createZsetObject(void) {
     zset *zs = zmalloc(sizeof(*zs));
-
     zs->dict = dictCreate(&zsetDictType,NULL);
     zs->zsl = zslCreate();
     return createObject(REDIS_ZSET,zs);
 }
 
+robj *createZsetZiplistObject(void) {
+    unsigned char *zl = ziplistNew();
+    robj *o = createObject(REDIS_ZSET,zl);
+    o->encoding = REDIS_ENCODING_ZIPLIST;
+    return o;
+}
+
 void freeStringObject(robj *o) {
     if (o->encoding == REDIS_ENCODING_RAW) {
         sdsfree(o->ptr);