X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fallocators.cc;h=aaa66dbaf21219dbe9645062b70f072287387814;hb=50f05a9503f10bbc6df4eb3ea02c7cf5e36fd6c9;hp=98c87591a53615e496babd67c4b605dd4e4449e6;hpb=c3136bce4decf4259ebb60ea2425b47017ad7bb1;p=m6w6%2Flibmemcached diff --git a/libmemcached/allocators.cc b/libmemcached/allocators.cc index 98c87591..aaa66dba 100644 --- a/libmemcached/allocators.cc +++ b/libmemcached/allocators.cc @@ -41,18 +41,18 @@ void _libmemcached_free(const memcached_st*, void *mem, void*) { if (mem) { - free(mem); + std::free(mem); } } void *_libmemcached_malloc(const memcached_st *, size_t size, void *) { - return malloc(size); + return std::malloc(size); } void *_libmemcached_realloc(const memcached_st*, void *mem, size_t size, void *) { - return realloc(mem, size); + return std::realloc(mem, size); } void *_libmemcached_calloc(const memcached_st *self, size_t nelem, size_t size, void *context) @@ -68,7 +68,7 @@ void *_libmemcached_calloc(const memcached_st *self, size_t nelem, size_t size, return ret; } - return calloc(nelem, size); + return std::calloc(nelem, size); } struct memcached_allocator_t memcached_allocators_return_default(void) @@ -126,8 +126,23 @@ void memcached_get_memory_allocators(const memcached_st *self, return; } - *mem_malloc= self->allocators.malloc; - *mem_free= self->allocators.free; - *mem_realloc= self->allocators.realloc; - *mem_calloc= self->allocators.calloc; + if (mem_malloc) + { + *mem_malloc= self->allocators.malloc; + } + + if (mem_free) + { + *mem_free= self->allocators.free; + } + + if (mem_realloc) + { + *mem_realloc= self->allocators.realloc; + } + + if (mem_calloc) + { + *mem_calloc= self->allocators.calloc; + } }