servers[x].address_info= NULL;
}
- if (ptr && ptr->call_free)
+ if (ptr)
ptr->call_free(ptr, servers);
else
free(servers);
{
memcached_continuum_item_st *new_ptr;
- if (ptr->call_realloc)
- new_ptr= (memcached_continuum_item_st *)ptr->call_realloc(ptr, ptr->continuum,
- sizeof(memcached_continuum_item_st) * (live_servers + MEMCACHED_CONTINUUM_ADDITION) * points_per_server);
- else
- new_ptr= (memcached_continuum_item_st *)realloc(ptr->continuum,
- sizeof(memcached_continuum_item_st) * (live_servers + MEMCACHED_CONTINUUM_ADDITION) * points_per_server);
+ new_ptr= ptr->call_realloc(ptr, ptr->continuum,
+ sizeof(memcached_continuum_item_st) * (live_servers + MEMCACHED_CONTINUUM_ADDITION) * points_per_server);
if (new_ptr == 0)
return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
if (is_ketama_weighted)
{
- int i;
+ unsigned int i;
for (i = 0; i < pointer_per_hash; i++)
{
value= ketama_server_hash(sort_host, sort_host_length, i);
return MEMCACHED_SUCCESS;
count= list[0].count;
- if (ptr->call_realloc)
- new_host_list=
- (memcached_server_st *)ptr->call_realloc(ptr, ptr->hosts,
- sizeof(memcached_server_st) * (count + ptr->number_of_hosts));
- else
- new_host_list=
- (memcached_server_st *)realloc(ptr->hosts,
- sizeof(memcached_server_st) * (count + ptr->number_of_hosts));
+ new_host_list= ptr->call_realloc(ptr, ptr->hosts,
+ sizeof(memcached_server_st) * (count + ptr->number_of_hosts));
if (!new_host_list)
return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
|| ( (type == MEMCACHED_CONNECTION_UDP) && !(ptr->flags & MEM_USE_UDP) ) )
return MEMCACHED_INVALID_HOST_PROTOCOL;
- if (ptr->call_realloc)
- new_host_list= (memcached_server_st *)ptr->call_realloc(ptr, ptr->hosts,
- sizeof(memcached_server_st) * (ptr->number_of_hosts+1));
- else
- new_host_list= (memcached_server_st *)realloc(ptr->hosts,
- sizeof(memcached_server_st) * (ptr->number_of_hosts+1));
+ new_host_list= ptr->call_realloc(ptr, ptr->hosts,
+ sizeof(memcached_server_st) * (ptr->number_of_hosts+1));
+
if (new_host_list == NULL)
return MEMCACHED_MEMORY_ALLOCATION_FAILURE;