Add missing #include for some headers
[wave300.git] / tools / shared / memdefs.h
bloba7ce9a5829a191626d5d84f2e907058a24f11adc
1 /******************************************************************************
3 Copyright (c) 2012
4 Lantiq Deutschland GmbH
6 For licensing information, see the file 'LICENSE' in the root folder of
7 this software module.
9 ******************************************************************************/
10 #ifndef __MEM_DEFS_H__
11 #define __MEM_DEFS_H__
13 #include "memtags.h"
15 #ifdef MTCFG_ENABLE_OBJPOOL
17 #include "mem_leak.h"
19 /* Special versions for objpool */
20 static __INLINE void *
21 malloc_objpool (size_t size, unsigned int tag)
23 return malloc(size);
26 static __INLINE void
27 free_objpool (void *buffer)
29 free(buffer);
32 /* Normal allocator that must be monitored by objpool */
33 static __INLINE void *
34 _malloc_tag (size_t size, unsigned int tag, mtlk_slid_t caller_slid)
36 void *buf = malloc(mem_leak_get_full_allocation_size(size));
37 return mem_leak_handle_allocated_buffer(buf, size, caller_slid);
40 static __INLINE void
41 _free_tag (void *buffer)
43 void *buf = mem_leak_handle_buffer_to_free(buffer);
44 free(buf);
47 #define malloc_tag(size, tag) _malloc_tag((size), (tag), MTLK_SLID)
48 #define free_tag(buffer) _free_tag(buffer)
50 #else /* MTCFG_ENABLE_OBJPOOL */
52 #define malloc_tag(a, b) malloc((a))
53 #define free_tag free
55 #endif /* MTCFG_ENABLE_OBJPOOL */
57 #endif /* __MEM_DEFS_H__ */