[PATCH 4/6] Make CAS to parse its parameters properly.

Tomash Brechko tomash.brechko at gmail.com
Thu Nov 8 14:56:26 UTC 2007


---
 trunk/server/memcached.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/trunk/server/memcached.c b/trunk/server/memcached.c
index 6abaf06..dd3fbbe 100644
--- a/trunk/server/memcached.c
+++ b/trunk/server/memcached.c
@@ -802,7 +802,7 @@ typedef struct token_s {
 #define KEY_TOKEN 1
 #define KEY_MAX_LENGTH 250
 
-#define MAX_TOKENS 6
+#define MAX_TOKENS 7
 
 /*
  * Tokenize the command string by replacing whitespace with '\0' and update
@@ -1225,8 +1225,7 @@ static void process_update_command(conn *c, token_t *tokens, const size_t ntoken
     exptime = strtol(tokens[3].value, NULL, 10);
     vlen = strtol(tokens[4].value, NULL, 10);
 
-    // does cas value exist?
-    if(tokens[5].value)
+    if (handle_cas)
     {
       req_memory_ptr = strtoull(tokens[5].value, NULL, 10);
     }
@@ -1540,7 +1539,7 @@ static void process_command(conn *c, char *command) {
 
         process_update_command(c, tokens, ntokens, comm, false);
 
-    } else if (ntokens == 6 && (strcmp(tokens[COMMAND_TOKEN].value, "cas") == 0)) {
+    } else if (ntokens == 7 && (strcmp(tokens[COMMAND_TOKEN].value, "cas") == 0)) {
 
         process_update_command(c, tokens, ntokens, NREAD_REPLACE, true);
 
-- 
1.5.3.5.529.ge3d6d


More information about the memcached mailing list