#include <libmemcached-1.0/struct/memcached.h>
+#ifdef __cplusplus
+#include <cstddef>
+#include <cstdlib>
+#include <memory>
+#else
+#include <stddef.h>
+#include <stdlib.h>
+#endif
+
static inline void libmemcached_free(const memcached_st *self, void *mem)
{
if (self)
}
else if (mem)
{
+#ifdef __cplusplus
+ std::free(mem);
+#else
free(mem);
+#endif
}
}
return self->allocators.malloc(self, size, self->allocators.context);
}
+#ifdef __cplusplus
+ return std::malloc(size);
+#else
return malloc(size);
+#endif
}
#define libmemcached_xmalloc(__memcachd_st, __type) ((__type *)libmemcached_malloc((__memcachd_st), sizeof(__type)))
return self->allocators.realloc(self, mem, nmemb * size, self->allocators.context);
}
+#ifdef __cplusplus
+ return std::realloc(mem, size);
+#else
return realloc(mem, size);
+#endif
}
#define libmemcached_xrealloc(__memcachd_st, __mem, __nelem, __type) ((__type *)libmemcached_realloc((__memcachd_st), (__mem), (__nelem), sizeof(__type)))
#define libmemcached_xvalloc(__memcachd_st, __nelem, __type) ((__type *)libmemcached_realloc((__memcachd_st), NULL, (__nelem), sizeof(__type)))
return self->allocators.calloc(self, nelem, size, self->allocators.context);
}
+#ifdef __cplusplus
+ return std::calloc(nelem, size);
+#else
return calloc(nelem, size);
+#endif
}
#define libmemcached_xcalloc(__memcachd_st, __nelem, __type) ((__type *)libmemcached_calloc((__memcachd_st), (__nelem), sizeof(__type)))