00001 /* 00002 * The copyright in this software is being made available under the 2-clauses 00003 * BSD License, included below. This software may be subject to other third 00004 * party and contributor rights, including patent rights, and no such rights 00005 * are granted under this license. 00006 * 00007 * Copyright (c) 2005, Herve Drolon, FreeImage Team 00008 * Copyright (c) 2007, Callum Lerwick <seg@haxxed.com> 00009 * All rights reserved. 00010 * 00011 * Redistribution and use in source and binary forms, with or without 00012 * modification, are permitted provided that the following conditions 00013 * are met: 00014 * 1. Redistributions of source code must retain the above copyright 00015 * notice, this list of conditions and the following disclaimer. 00016 * 2. Redistributions in binary form must reproduce the above copyright 00017 * notice, this list of conditions and the following disclaimer in the 00018 * documentation and/or other materials provided with the distribution. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 00021 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00022 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00023 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00024 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00025 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00026 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00027 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00028 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00029 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00030 * POSSIBILITY OF SUCH DAMAGE. 00031 */ 00032 #ifndef OPJ_MALLOC_H 00033 #define OPJ_MALLOC_H 00034 00035 #include <stddef.h> 00045 00048 /* ----------------------------------------------------------------------- */ 00049 00055 void * opj_malloc(size_t size); 00056 00063 void * opj_calloc(size_t numOfElements, size_t sizeOfElements); 00064 00070 void * opj_aligned_malloc(size_t size); 00071 void * opj_aligned_realloc(void *ptr, size_t size); 00072 void opj_aligned_free(void* ptr); 00073 00079 void * opj_aligned_32_malloc(size_t size); 00080 void * opj_aligned_32_realloc(void *ptr, size_t size); 00081 00088 void * opj_realloc(void * m, size_t s); 00089 00094 void opj_free(void * m); 00095 00096 #if defined(__GNUC__) && !defined(OPJ_SKIP_POISON) 00097 #pragma GCC poison malloc calloc realloc free 00098 #endif 00099 00100 /* ----------------------------------------------------------------------- */ 00104 00105 #endif /* OPJ_MALLOC_H */ 00106