Anonymous avatar Anonymous committed 7f8305d

fix code review comments.

Comments (0)

Files changed (3)

 
 static void addToReply(void *context, robj *keyobj) {
     redisClient *c = (redisClient *)context;
-    if (expireIfNeeded(c->db,keyobj) == 0) {
-        addReplyBulk(c,keyobj);
-    }
+    addReplyBulk(c,keyobj);
 }
 
 static void addToList(void *context, robj *keyobj) {
 
 void keystolistCommand(redisClient *c) {
     sds pattern = c->argv[1]->ptr;
-    robj *lobj = lookupKeyWrite(c->db,c->argv[2]);
+    robj *key = c->argv[2];
+    robj *lobj = lookupKeyWrite(c->db,key);
     unsigned long numkeys;
 
     if (lobj != NULL) {
             addReply(c,shared.wrongtypeerr);
             return;
         }
-        dbDelete(c->db,c->argv[2]);
+        dbDelete(c->db,key);
     }
     lobj = createZiplistObject();
-    dbAdd(c->db,c->argv[2],lobj);
+    dbAdd(c->db,key,lobj);
 
     numkeys = scanKeys(c->db,pattern,addToList,lobj);
     addReplyLongLong(c,numkeys);
-    touchWatchedKey(c->db,c->argv[2]);
+    touchWatchedKey(c->db,key);
     server.dirty++;
 }
 
         if (tryFreeOneObjectFromFreelist() == REDIS_OK) continue;
         for (j = 0; j < server.dbnum; j++) {
             int minttl = -1;
-            robj *minkey = NULL;
+            sds minkey = NULL;
             struct dictEntry *de;
 
             if (dictSize(server.db[j].expires)) {
                     }
                 }
 
-                dictDelete(server.db[j].expires,minkey);
-                dictDelete(server.db[j].dict,minkey);
-                server.db[j].expired_count++;
-                server.db[j].prematurely_expired_count++;
+                if (dictDelete(server.db[j].expires,minkey) == DICT_OK &&
+                    dictDelete(server.db[j].dict,minkey) == DICT_OK) {
+                    server.db[j].expired_count++;
+                    server.db[j].prematurely_expired_count++;
+                }
             }
         }
         if (!freed) return; /* nothing to free... */
 #else /* HAVE_BACKTRACE */
 void setupSigSegvAction(void) {
 }
+void setupSigTermAction(void) {
+}
 #endif /* HAVE_BACKTRACE */
 
 /* The End */
 void freeMemoryIfNeeded(void);
 int processCommand(redisClient *c);
 void setupSigSegvAction(void);
+void setupSigTermAction(void);
 struct redisCommand *lookupCommand(char *name);
 void call(redisClient *c, struct redisCommand *cmd);
 int prepareForShutdown();
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.