]> git.saurik.com Git - redis.git/blobdiff - src/t_hash.c
dict.c: added two lower level methods for directly manipulating hash entries. This...
[redis.git] / src / t_hash.c
index 4b9b37d69fed10b3c3586583dc0b38997647e887..3ccdfd142c81ac9a4328fe1f8fcbfaaf042458ee 100644 (file)
@@ -160,7 +160,7 @@ hashTypeIterator *hashTypeInitIterator(robj *subject) {
     } else if (hi->encoding == REDIS_ENCODING_HT) {
         hi->di = dictGetIterator(subject->ptr);
     } else {
-        redisAssert(NULL);
+        redisAssertWithInfo(NULL,subject,0);
     }
     return hi;
 }
@@ -250,7 +250,7 @@ void convertToRealHash(robj *o) {
     unsigned int klen, vlen;
     dict *dict = dictCreate(&hashDictType,NULL);
 
-    redisAssert(o->type == REDIS_HASH && o->encoding != REDIS_ENCODING_HT);
+    redisAssertWithInfo(NULL,o,o->type == REDIS_HASH && o->encoding != REDIS_ENCODING_HT);
     p = zipmapRewind(zm);
     while((p = zipmapNext(p,&key,&klen,&val,&vlen)) != NULL) {
         robj *keyobj, *valobj;
@@ -403,8 +403,11 @@ void hdelCommand(redisClient *c) {
 
     for (j = 2; j < c->argc; j++) {
         if (hashTypeDelete(o,c->argv[j])) {
-            if (hashTypeLength(o) == 0) dbDelete(c->db,c->argv[1]);
             deleted++;
+            if (hashTypeLength(o) == 0) {
+                dbDelete(c->db,c->argv[1]);
+                break;
+            }
         }
     }
     if (deleted) {