X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/a4c507866cb091074458a0a48120a95339b350c4..12f72a714c6266269b7c9066b7e1349c7682a8e7:/redis.c diff --git a/redis.c b/redis.c index c40b6eec..3f09763f 100644 --- a/redis.c +++ b/redis.c @@ -1005,6 +1005,10 @@ static int dictEncObjKeyCompare(void *privdata, const void *key1, robj *o1 = (robj*) key1, *o2 = (robj*) key2; int cmp; + if (o1->encoding == REDIS_ENCODING_INT && + o2->encoding == REDIS_ENCODING_INT && + o1->ptr == o2->ptr) return 1; + o1 = getDecodedObject(o1); o2 = getDecodedObject(o2); cmp = sdsDictKeyCompare(privdata,o1->ptr,o2->ptr); @@ -5943,9 +5947,12 @@ static void hdelCommand(redisClient *c) { checkType(c,o,REDIS_HASH)) return; if (o->encoding == REDIS_ENCODING_ZIPMAP) { + robj *field = getDecodedObject(c->argv[2]); + o->ptr = zipmapDel((unsigned char*) o->ptr, - (unsigned char*) c->argv[2]->ptr, - sdslen(c->argv[2]->ptr), &deleted); + (unsigned char*) field->ptr, + sdslen(field->ptr), &deleted); + decrRefCount(field); } else { deleted = dictDelete((dict*)o->ptr,c->argv[2]) == DICT_OK; }