Deprecate MEMCACHED_NO_KEY_PROVIDED, and fixed key validation tests for the binary...
[m6w6/libmemcached] / libmemcached / memcached.c
index d5bfd19060986eb50703c20ccd9d246e9b3f6d37..1144115f6a6e3d9cde4525a7a1742bde33f27b1c 100644 (file)
@@ -15,7 +15,7 @@ memcached_st *memcached_create(memcached_st *ptr)
       return NULL; /*  MEMCACHED_MEMORY_ALLOCATION_FAILURE */
 
     memset(ptr, 0, sizeof(memcached_st));
-    ptr->is_allocated= MEMCACHED_ALLOCATED;
+    ptr->is_allocated= true;
   }
   else
   {
@@ -28,6 +28,10 @@ memcached_st *memcached_create(memcached_st *ptr)
   ptr->retry_timeout= 0;
   ptr->distribution= MEMCACHED_DISTRIBUTION_MODULA;
 
+  /* TODO, Document why we picked these defaults */
+  ptr->io_msg_watermark= 500;
+  ptr->io_bytes_watermark= 65 * 1024;
+
   return ptr;
 }
 
@@ -49,7 +53,7 @@ void memcached_free(memcached_st *ptr)
       free(ptr->continuum);
   }
 
-  if (ptr->is_allocated == MEMCACHED_ALLOCATED)
+  if (ptr->is_allocated)
   {
     if (ptr->call_free)
       ptr->call_free(ptr, ptr);
@@ -57,7 +61,7 @@ void memcached_free(memcached_st *ptr)
       free(ptr);
   }
   else
-    ptr->is_allocated= MEMCACHED_USED;
+    memset(ptr, 0, sizeof(memcached_st));
 }
 
 /*
@@ -73,7 +77,7 @@ memcached_st *memcached_clone(memcached_st *clone, memcached_st *source)
   if (source == NULL)
     return memcached_create(clone);
 
-  if (clone && clone->is_allocated == MEMCACHED_USED)
+  if (clone && clone->is_allocated)
   {
     return NULL;
   }