Committing for 0.17. Cleanups and one bad WATCHPOINT removed.
[m6w6/libmemcached] / lib / memcached_storage.c
index 30585095fa9b8588b5e4cc3026217111702cd7c3..0b5a73e10b3d45a0912f13c52ca47babf5cfdae7 100644 (file)
@@ -57,16 +57,13 @@ static inline memcached_return memcached_send(memcached_st *ptr,
   char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
   unsigned int server_key;
 
-  WATCHPOINT_ASSERT(!(value == NULL && value_length > 0));
-  WATCHPOINT_ASSERT(!(value && value_length == 0));
-
-  if (key_length == 0)
+  unlikely (key_length == 0)
     return MEMCACHED_NO_KEY_PROVIDED;
 
-  if (ptr->number_of_hosts == 0)
+  unlikely (ptr->number_of_hosts == 0)
     return MEMCACHED_NO_SERVERS;
 
-  if (key_test(&key, &key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED)
+  if ((ptr->flags & MEM_VERIFY_KEY) && (memcachd_key_test(&key, &key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED))
     return MEMCACHED_BAD_KEY_PROVIDED;
 
   server_key= memcached_generate_hash(ptr, master_key, master_key_length);
@@ -206,7 +203,7 @@ memcached_return memcached_cas(memcached_st *ptr,
   memcached_return rc;
   rc= memcached_send(ptr, key, key_length, 
                      key, key_length, value, value_length,
-                     expiration, flags, cas, APPEND_OP);
+                     expiration, flags, cas, CAS_OP);
   return rc;
 }
 
@@ -297,6 +294,6 @@ memcached_return memcached_cas_by_key(memcached_st *ptr,
   memcached_return rc;
   rc= memcached_send(ptr, key, key_length, 
                      key, key_length, value, value_length,
-                     expiration, flags, cas, APPEND_OP);
+                     expiration, flags, cas, CAS_OP);
   return rc;
 }