RetroArch
mem_allocate.h
Go to the documentation of this file.
1 /*
2  mem_allocate.h
3  Memory allocation and destruction calls
4  Replace these calls with custom allocators if
5  malloc is unavailable
6 
7  Copyright (c) 2006 Michael "Chishm" Chisholm
8 
9  Redistribution and use in source and binary forms, with or without modification,
10  are permitted provided that the following conditions are met:
11 
12  1. Redistributions of source code must retain the above copyright notice,
13  this list of conditions and the following disclaimer.
14  2. Redistributions in binary form must reproduce the above copyright notice,
15  this list of conditions and the following disclaimer in the documentation and/or
16  other materials provided with the distribution.
17  3. The name of the author may not be used to endorse or promote products derived
18  from this software without specific prior written permission.
19 
20  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
21  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
23  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 
31 #ifndef _MEM_ALLOCATE_H
32 #define _MEM_ALLOCATE_H
33 
34 #include <malloc.h>
35 
36 static inline void* _FAT_mem_allocate (size_t size)
37 {
38  return malloc (size);
39 }
40 
41 static inline void* _FAT_mem_align (size_t size)
42 {
43 #ifdef __wii__
44  return memalign (32, size);
45 #else
46  return malloc (size);
47 #endif
48 }
49 
50 static inline void _FAT_mem_free (void* mem)
51 {
52  free (mem);
53 }
54 
55 #endif /* _MEM_ALLOCATE_H */
static void _FAT_mem_free(void *mem)
Definition: mem_allocate.h:50
void * malloc(YYSIZE_T)
Definition: memr.c:17
GLsizeiptr size
Definition: glext.h:6559
static void * _FAT_mem_align(size_t size)
Definition: mem_allocate.h:41
void free(void *)
static void * _FAT_mem_allocate(size_t size)
Definition: mem_allocate.h:36