return NULL; /* MEMCACHED_MEMORY_ALLOCATION_FAILURE */
memset(ptr, 0, sizeof(memcached_st));
- ptr->is_allocated= MEMCACHED_ALLOCATED;
+ ptr->is_allocated= true;
}
else
{
ptr->retry_timeout= 0;
ptr->distribution= MEMCACHED_DISTRIBUTION_MODULA;
- ptr->io_msg_watermark = 500;
- ptr->io_bytes_watermark = 65 * 1024;
+ /* TODO, Document why we picked these defaults */
+ ptr->io_msg_watermark= 500;
+ ptr->io_bytes_watermark= 65 * 1024;
return ptr;
}
free(ptr->continuum);
}
- if (ptr->is_allocated == MEMCACHED_ALLOCATED)
+ if (ptr->is_allocated)
{
if (ptr->call_free)
ptr->call_free(ptr, ptr);
free(ptr);
}
else
- ptr->is_allocated= MEMCACHED_USED;
+ memset(ptr, 0, sizeof(memcached_st));
}
/*
if (source == NULL)
return memcached_create(clone);
- if (clone && clone->is_allocated == MEMCACHED_USED)
+ if (clone && clone->is_allocated)
{
return NULL;
}
if (new_clone == NULL)
return NULL;
- if (source->hosts)
- rc= memcached_server_push(new_clone, source->hosts);
-
- if (rc != MEMCACHED_SUCCESS)
- {
- memcached_free(new_clone);
-
- return NULL;
- }
-
-
new_clone->flags= source->flags;
new_clone->send_size= source->send_size;
new_clone->recv_size= source->recv_size;
new_clone->get_key_failure= source->get_key_failure;
new_clone->delete_trigger= source->delete_trigger;
+ if (source->hosts)
+ rc= memcached_server_push(new_clone, source->hosts);
+
+ if (rc != MEMCACHED_SUCCESS)
+ {
+ memcached_free(new_clone);
+
+ return NULL;
+ }
+
+
if (source->prefix_key[0] != 0)
{
strcpy(new_clone->prefix_key, source->prefix_key);