]> git.saurik.com Git - redis.git/blobdiff - src/t_hash.c
Better pretty printed makefile output
[redis.git] / src / t_hash.c
index 5e7525bd13a383f38dc54f1420783c01a4acaf64..4b9b37d69fed10b3c3586583dc0b38997647e887 100644 (file)
@@ -396,17 +396,22 @@ void hmgetCommand(redisClient *c) {
 
 void hdelCommand(redisClient *c) {
     robj *o;
 
 void hdelCommand(redisClient *c) {
     robj *o;
+    int j, deleted = 0;
+
     if ((o = lookupKeyWriteOrReply(c,c->argv[1],shared.czero)) == NULL ||
         checkType(c,o,REDIS_HASH)) return;
 
     if ((o = lookupKeyWriteOrReply(c,c->argv[1],shared.czero)) == NULL ||
         checkType(c,o,REDIS_HASH)) return;
 
-    if (hashTypeDelete(o,c->argv[2])) {
-        if (hashTypeLength(o) == 0) dbDelete(c->db,c->argv[1]);
-        addReply(c,shared.cone);
+    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 (deleted) {
         signalModifiedKey(c->db,c->argv[1]);
         signalModifiedKey(c->db,c->argv[1]);
-        server.dirty++;
-    } else {
-        addReply(c,shared.czero);
+        server.dirty += deleted;
     }
     }
+    addReplyLongLong(c,deleted);
 }
 
 void hlenCommand(redisClient *c) {
 }
 
 void hlenCommand(redisClient *c) {