X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fallocators.cc;h=aaa66dbaf21219dbe9645062b70f072287387814;hb=09b4ff9a9b7c62b4511ab10c9305eba757fea34b;hp=98c87591a53615e496babd67c4b605dd4e4449e6;hpb=ad7ce5a1c9769432d8105c1a3a3a67b12d8bd731;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; + } }