memcached_st *memcached_create(memcached_st *ptr)
{
- memcached_result_st *result_ptr;
-
if (ptr == NULL)
{
ptr= (memcached_st *)calloc(1, sizeof(memcached_st));
memcached_set_memory_allocators(ptr, NULL, NULL, NULL, NULL);
- result_ptr= memcached_result_create(ptr, &ptr->result);
- WATCHPOINT_ASSERT(result_ptr);
+ if (! memcached_result_create(ptr, &ptr->result))
+ {
+ memcached_free(ptr);
+ return NULL;
+ }
ptr->poll_timeout= MEMCACHED_DEFAULT_TIMEOUT;
ptr->connect_timeout= MEMCACHED_DEFAULT_TIMEOUT;
ptr->retry_timeout= 0;
ptr->io_bytes_watermark= 65 * 1024;
WATCHPOINT_ASSERT_INITIALIZED(&ptr->result);
- WATCHPOINT_ASSERT_INITIALIZED(&ptr->hashkit);
return ptr;
}
new_clone->retry_timeout= source->retry_timeout;
new_clone->distribution= source->distribution;
new_clone->hash= source->hash;
- new_clone->hash_continuum= source->hash_continuum;
+ new_clone->distribution_hash= source->distribution_hash;
new_clone->user_data= source->user_data;
new_clone->snd_timeout= source->snd_timeout;
}
rc= run_distribution(new_clone);
+
if (rc != MEMCACHED_SUCCESS)
{
memcached_free(new_clone);
return new_clone;
}
+
void *memcached_get_user_data(memcached_st *ptr)
{
return ptr->user_data;
{
void *ret= ptr->user_data;
ptr->user_data= data;
+
return ret;
}