]> git.saurik.com Git - redis.git/commitdiff
Fixed a minor bug in GETSET, now the SET part is not performed if the GET fails becau...
authorantirez <antirez@gmail.com>
Thu, 24 Dec 2009 14:40:11 +0000 (09:40 -0500)
committerantirez <antirez@gmail.com>
Thu, 24 Dec 2009 14:40:11 +0000 (09:40 -0500)
TODO
redis.c

diff --git a/TODO b/TODO
index 74f133476b77abea9bbc6ec4b49d1123874954a3..f3eaeb21908bc12bb58abf7c63e374a7947b69b3 100644 (file)
--- a/TODO
+++ b/TODO
@@ -42,6 +42,7 @@ BIG ONES:
 * Specially encoded memory-saving integer sets.
 * A command to export a JSON dump (there should be mostly working patch needing major reworking).
 * Specially encoded sets of integers (this includes a big refactoring providing an higher level layer for Sets manipulation)
+* ZRANK: http://docs.google.com/viewer?a=v&q=cache:tCQaP3ZeN4YJ:courses.csail.mit.edu/6.046/spring04/handouts/ps5-sol.pdf+skip+list+rank+operation+augmented&hl=en&pid=bl&srcid=ADGEEShXuNjTcZyXw_1cq9OaWpSXy3PprjXqVzmM-LE0ETFznLyrDXJKQ_mBPNT10R8ErkoiXD9JbMw_FaoHmOA4yoGVrA7tZWiy393JwfCwuewuP93sjbkzZ_gnEp83jYhPYjThaIzw&sig=AHIEtbRF0GkYCdYRFtTJBE69senXZwFY0w
 
 SMALL ONES:
 
diff --git a/redis.c b/redis.c
index 07287605c756b1a5c30e71c74f25b459b87dabd2..bfdc696cf7162ba352ee56d7dad125d8677a6da5 100644 (file)
--- a/redis.c
+++ b/redis.c
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#define REDIS_VERSION "1.1.94"
+#define REDIS_VERSION "1.1.95"
 
 #include "fmacros.h"
 #include "config.h"
@@ -3018,24 +3018,31 @@ static void setnxCommand(redisClient *c) {
     setGenericCommand(c,1);
 }
 
-static void getCommand(redisClient *c) {
+static int getGenericCommand(redisClient *c) {
     robj *o = lookupKeyRead(c->db,c->argv[1]);
 
     if (o == NULL) {
         addReply(c,shared.nullbulk);
+        return REDIS_OK;
     } else {
         if (o->type != REDIS_STRING) {
             addReply(c,shared.wrongtypeerr);
+            return REDIS_ERR;
         } else {
             addReplyBulkLen(c,o);
             addReply(c,o);
             addReply(c,shared.crlf);
+            return REDIS_OK;
         }
     }
 }
 
+static void getCommand(redisClient *c) {
+    getGenericCommand(c);
+}
+
 static void getsetCommand(redisClient *c) {
-    getCommand(c);
+    if (getGenericCommand(c) == REDIS_ERR) return;
     if (dictAdd(c->db->dict,c->argv[1],c->argv[2]) == DICT_ERR) {
         dictReplace(c->db->dict,c->argv[1],c->argv[2]);
     } else {