projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Merge up for version.
[awesomized/libmemcached]
/
libmemcached
/
memory.h
diff --git
a/libmemcached/memory.h
b/libmemcached/memory.h
index 7b30e3711314b5cd731ffab7cce81d8dbbed45c9..65d06b8c77a2b8940485db8d43d7258513372933 100644
(file)
--- a/
libmemcached/memory.h
+++ b/
libmemcached/memory.h
@@
-38,20
+38,42
@@
static inline void libmemcached_free(const memcached_st *self, void *mem)
{
static inline void libmemcached_free(const memcached_st *self, void *mem)
{
- self->allocators.free(self, mem, self->allocators.context);
+ if (self)
+ {
+ self->allocators.free(self, mem, self->allocators.context);
+ }
+ else if (mem)
+ {
+ free(mem);
+ }
}
static inline void *libmemcached_malloc(const memcached_st *self, const size_t size)
{
}
static inline void *libmemcached_malloc(const memcached_st *self, const size_t size)
{
- return self->allocators.malloc(self, size, self->allocators.context);
+ if (self)
+ {
+ return self->allocators.malloc(self, size, self->allocators.context);
+ }
+
+ return malloc(size);
}
static inline void *libmemcached_realloc(const memcached_st *self, void *mem, const size_t size)
{
}
static inline void *libmemcached_realloc(const memcached_st *self, void *mem, const size_t size)
{
- return self->allocators.realloc(self, mem, size, self->allocators.context);
+ if (self)
+ {
+ return self->allocators.realloc(self, mem, size, self->allocators.context);
+ }
+
+ return realloc(mem, size);
}
static inline void *libmemcached_calloc(const memcached_st *self, size_t nelem, size_t size)
{
}
static inline void *libmemcached_calloc(const memcached_st *self, size_t nelem, size_t size)
{
- return self->allocators.calloc(self, nelem, size, self->allocators.context);
+ if (self)
+ {
+ return self->allocators.calloc(self, nelem, size, self->allocators.context);
+ }
+
+ return calloc(nelem, size);
}
}