{
memcached_continuum_item_st *new_ptr;
- new_ptr= static_cast<memcached_continuum_item_st*>(libmemcached_realloc(ptr, ptr->ketama.continuum,
- (live_servers + MEMCACHED_CONTINUUM_ADDITION) * points_per_server,
- sizeof(memcached_continuum_item_st)));
+ new_ptr= libmemcached_xrealloc(ptr, ptr->ketama.continuum, (live_servers + MEMCACHED_CONTINUUM_ADDITION) * points_per_server, memcached_continuum_item_st);
if (new_ptr == 0)
{
{
assert_msg(ptr, "Programmer mistake, somehow server_add() was passed a NULL memcached_st");
- memcached_server_st *new_host_list= static_cast<memcached_server_st*>(libmemcached_realloc(ptr, memcached_server_list(ptr),
- (ptr->number_of_hosts + 1),
- sizeof(memcached_server_st)));
+ memcached_server_st *new_host_list= libmemcached_xrealloc(ptr, memcached_server_list(ptr), (ptr->number_of_hosts + 1), memcached_server_st);
if (new_host_list == NULL)
{
uint32_t count= memcached_server_list_count(list);
memcached_server_st *new_host_list;
- new_host_list= static_cast<memcached_server_st*>(libmemcached_realloc(ptr, memcached_server_list(ptr),
- (count + memcached_server_count(ptr)), sizeof(memcached_server_st)));
+ new_host_list= libmemcached_xrealloc(ptr, memcached_server_list(ptr), (count + memcached_server_count(ptr)), memcached_server_st);
if (new_host_list == NULL)
{
memcached_destroy_sasl_auth_data(ptr);
- sasl_callback_t *callbacks= (sasl_callback_t*)libmemcached_calloc(ptr, 4, sizeof(sasl_callback_t));
+ sasl_callback_t *callbacks= libmemcached_xcalloc(ptr, 4, sasl_callback_t);
size_t password_length= strlen(password);
size_t username_length= strlen(username);
char *name= (char *)libmemcached_malloc(ptr, username_length +1);
++total;
}
- sasl_callback_t *callbacks= (sasl_callback_t*)libmemcached_calloc(clone, total +1, sizeof(sasl_callback_t));
+ sasl_callback_t *callbacks= libmemcached_xcalloc(clone, total +1, sasl_callback_t);
if (callbacks == NULL)
{
return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
return NULL;
}
- memcached_stat_st *stats= static_cast<memcached_stat_st *>(libmemcached_calloc(self, memcached_server_count(self), sizeof(memcached_stat_st)));
+ memcached_stat_st *stats= libmemcached_xcalloc(self, memcached_server_count(self), memcached_stat_st);
if (not stats)
{
if (need && need > (size_t)(string->current_size - (size_t)(string->end - string->string)))
{
size_t current_offset= (size_t) (string->end - string->string);
- char *new_value;
size_t adjust;
size_t new_size;
if (new_size < need)
return memcached_set_error(*string->root, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT);
- new_value= static_cast<char *>(libmemcached_realloc(string->root, string->string, new_size, sizeof(char)));
+ char *new_value= libmemcached_xrealloc(string->root, string->string, new_size, char);
- if (not new_value)
+ if (new_value == NULL)
{
return memcached_set_error(*string->root, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT);
}