More modifications to the C++ interface. Changing the return type of a
[awesomized/libmemcached] / libmemcached / memcached_result.c
index 0860e792e528f6ae3de02b725e03a8ce27454fa2..1462b89c3ef42e446162e44842931800bfbfcba7 100644 (file)
@@ -11,27 +11,19 @@ memcached_result_st *memcached_result_create(memcached_st *memc,
 {
   /* Saving malloc calls :) */
   if (ptr)
-  {
     memset(ptr, 0, sizeof(memcached_result_st));
-    ptr->is_allocated= MEMCACHED_NOT_ALLOCATED;
-  }
   else
   {
-    if (memc->call_malloc)
-      ptr= (memcached_result_st *)memc->call_malloc(memc, sizeof(memcached_result_st));
-    else
-      ptr= (memcached_result_st *)malloc(sizeof(memcached_result_st));
+    ptr= memc->call_malloc(memc, sizeof(memcached_result_st));
 
     if (ptr == NULL)
       return NULL;
-    memset(ptr, 0, sizeof(memcached_result_st));
-    ptr->is_allocated= MEMCACHED_ALLOCATED;
+    ptr->is_allocated= true;
   }
 
   ptr->root= memc;
   memcached_string_create(memc, &ptr->value, 0);
   WATCHPOINT_ASSERT(ptr->value.string == NULL);
-  WATCHPOINT_ASSERT(ptr->value.is_allocated == MEMCACHED_NOT_ALLOCATED);
 
   return ptr;
 }
@@ -60,8 +52,6 @@ void memcached_result_free(memcached_result_st *ptr)
 
   memcached_string_free(&ptr->value);
 
-  if (ptr->is_allocated == MEMCACHED_ALLOCATED)
+  if (ptr->is_allocated)
     free(ptr);
-  else
-    ptr->is_allocated= MEMCACHED_USED;
 }