Update for storage to now use vector
[m6w6/libmemcached] / libmemcached / exist.cc
index b8d4b0d876a325255d6ec9d36a94098f75b087de..ff0c1b42bfb05171fdb7eb7a239d0c3c30da942f 100644 (file)
@@ -40,14 +40,14 @@ static memcached_return_t ascii_exist(memcached_st *memc, memcached_server_write
 {
   struct libmemcached_io_vector_st vector[]=
   {
-    { sizeof("add ") -1, "add " },
-    { memcached_array_size(memc->_namespace), memcached_array_string(memc->_namespace) },
-    { key_length, key },
-    { sizeof(" 0") -1, " 0" },
-    { sizeof(" 2678400") -1, " 2678400" },
-    { sizeof(" 0") -1, " 0" },
-    { 2, "\r\n" },
-    { 2, "\r\n" }
+    { memcached_literal_param("add ") },
+    { memcached_array_string(memc->_namespace), memcached_array_size(memc->_namespace) },
+    { key, key_length },
+    { memcached_literal_param(" 0") },
+    { memcached_literal_param(" 2678400") },
+    { memcached_literal_param(" 0") },
+    { memcached_literal_param("\r\n") },
+    { memcached_literal_param("\r\n") }
   };
 
   /* Send command header */
@@ -58,14 +58,20 @@ static memcached_return_t ascii_exist(memcached_st *memc, memcached_server_write
     rc= memcached_response(instance, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
 
     if (rc == MEMCACHED_NOTSTORED)
+    {
       rc= MEMCACHED_SUCCESS;
+    }
 
     if (rc == MEMCACHED_STORED)
+    {
       rc= MEMCACHED_NOTFOUND;
+    }
   }
 
   if (rc == MEMCACHED_WRITE_FAILURE)
+  {
     memcached_io_reset(instance);
+  }
 
   return rc;
 }
@@ -89,9 +95,9 @@ static memcached_return_t binary_exist(memcached_st *memc, memcached_server_writ
 
   struct libmemcached_io_vector_st vector[]=
   {
-    { send_length, request.bytes },
-    { memcached_array_size(memc->_namespace), memcached_array_string(memc->_namespace) },
-    { key_length, key }
+    { request.bytes, send_length },
+    { memcached_array_string(memc->_namespace), memcached_array_size(memc->_namespace) },
+    { key, key_length }
   };
 
   /* write the header */