memcache/command.c
changeset 46 8a832c0e01ee
parent 43 e5b714190dee
child 48 1c67f512779b
equal deleted inserted replaced
45:10d514029c64 46:8a832c0e01ee
    92         case MEMCACHE_CMD_STORE_PREPEND:
    92         case MEMCACHE_CMD_STORE_PREPEND:
    93             assert(key != NULL && obj != NULL);
    93             assert(key != NULL && obj != NULL);
    94             assert(key->len > 0 && key->buf != NULL);
    94             assert(key->len > 0 && key->buf != NULL);
    95             // XXX: ensure that we have a valid buf
    95             // XXX: ensure that we have a valid buf
    96 
    96 
    97             if (evbuffer_add_printf(buf, "%s %*s %u %lu %zu\r\n", cmd_name, (int) key->len, key->buf, obj->flags, obj->exptime, obj->bytes))
    97             if (evbuffer_add_printf(buf, "%s %*s %u %lu %zu\r\n", cmd_name, (int) key->len, key->buf, obj->flags, obj->exptime, obj->bytes) == -1)
    98                 ERROR("evbuffer_add_printf");
    98                 ERROR("evbuffer_add_printf");
    99 
    99 
   100             break;
   100             break;
   101 
   101 
   102         case MEMCACHE_CMD_STORE_CAS:
   102         case MEMCACHE_CMD_STORE_CAS:
   140         }
   140         }
   141 
   141 
   142     } while (line_length == 0);
   142     } while (line_length == 0);
   143     
   143     
   144     // just check to make sure that it really is null-delimited
   144     // just check to make sure that it really is null-delimited
   145     assert(line[line_length - 1] == '\0');
   145     assert(line[line_length] == '\0');
   146 
   146 
   147     // use strsep
   147     // use strsep
   148     token_cursor = line;
   148     token_cursor = line;
   149 
   149 
   150     // the first token should be the reply name
   150     // the first token should be the reply name