OpenJPEG 2.5.3
opj_malloc.h
Go to the documentation of this file.
1/*
2 * The copyright in this software is being made available under the 2-clauses
3 * BSD License, included below. This software may be subject to other third
4 * party and contributor rights, including patent rights, and no such rights
5 * are granted under this license.
6 *
7 * Copyright (c) 2005, Herve Drolon, FreeImage Team
8 * Copyright (c) 2007, Callum Lerwick <seg@haxxed.com>
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32#ifndef OPJ_MALLOC_H
33#define OPJ_MALLOC_H
34
35#include <stddef.h>
42
45
48/* ----------------------------------------------------------------------- */
49
55void * opj_malloc(size_t size);
56
63void * opj_calloc(size_t numOfElements, size_t sizeOfElements);
64
70void * opj_aligned_malloc(size_t size);
71void * opj_aligned_realloc(void *ptr, size_t size);
72void opj_aligned_free(void* ptr);
73
79void * opj_aligned_32_malloc(size_t size);
80void * opj_aligned_32_realloc(void *ptr, size_t size);
81
88void * opj_realloc(void * m, size_t s);
89
94void opj_free(void * m);
95
96#if defined(__GNUC__) && !defined(OPJ_SKIP_POISON)
97#pragma GCC poison malloc calloc realloc free
98#endif
99
100/* ----------------------------------------------------------------------- */
102
104
105#endif /* OPJ_MALLOC_H */
106
void * opj_malloc(size_t size)
Allocate an uninitialized memory block.
Definition opj_malloc.c:191
void opj_free(void *m)
Deallocates or frees a memory block.
Definition opj_malloc.c:246
void * opj_aligned_malloc(size_t size)
Allocate memory aligned to a 16 byte boundary.
Definition opj_malloc.c:207
void * opj_aligned_32_realloc(void *ptr, size_t size)
Definition opj_malloc.c:220
void * opj_aligned_realloc(void *ptr, size_t size)
Definition opj_malloc.c:211
void * opj_calloc(size_t numOfElements, size_t sizeOfElements)
Allocate a memory block with elements initialized to 0.
Definition opj_malloc.c:198
void * opj_realloc(void *m, size_t s)
Reallocate memory blocks.
Definition opj_malloc.c:239
void * opj_aligned_32_malloc(size_t size)
Allocate memory aligned to a 32 byte boundary.
Definition opj_malloc.c:216
void opj_aligned_free(void *ptr)
Definition opj_malloc.c:225