X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=inline;f=libmemcached%2Fmemory.h;fp=libmemcached%2Fmemory.h;h=7b30e3711314b5cd731ffab7cce81d8dbbed45c9;hb=b16fffff43d822239ce79a366ec36873b0803df9;hp=0000000000000000000000000000000000000000;hpb=f604664b5fe098d3e22497896921c7dee5dcccd3;p=awesomized%2Flibmemcached diff --git a/libmemcached/memory.h b/libmemcached/memory.h new file mode 100644 index 00000000..7b30e371 --- /dev/null +++ b/libmemcached/memory.h @@ -0,0 +1,57 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +static inline void libmemcached_free(const memcached_st *self, void *mem) +{ + self->allocators.free(self, mem, self->allocators.context); +} + +static inline void *libmemcached_malloc(const memcached_st *self, const size_t size) +{ + return self->allocators.malloc(self, size, self->allocators.context); +} + +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); +} + +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); +}