From dbcc8d46f5f2d713b55bdb41e229d23018a3289a Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 4 Dec 2016 16:55:52 +0100 Subject: [PATCH] Fixed: Use macros instead of functions for memory align wrappers (easier to find memory leaks) --HG-- branch : develop --- code/nel/include/nel/misc/types_nl.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/nel/include/nel/misc/types_nl.h b/code/nel/include/nel/misc/types_nl.h index 5f25387f5..4f9302260 100644 --- a/code/nel/include/nel/misc/types_nl.h +++ b/code/nel/include/nel/misc/types_nl.h @@ -386,17 +386,17 @@ typedef unsigned int uint; // at least 32bits (depend of processor) #include #include #include -inline void *aligned_malloc(size_t size, size_t alignment) { return _aligned_malloc(size, alignment); } -inline void aligned_free(void *ptr) { _aligned_free(ptr); } +#define aligned_malloc(size, alignment) _aligned_malloc(size, alignment) +#define aligned_free(ptr) _aligned_free(ptr) #elif defined(NL_OS_MAC) #include // under Mac OS X, malloc is already aligned for SSE and Altivec (16 bytes alignment) -inline void *aligned_malloc(size_t size, size_t /* alignment */) { return malloc(size); } -inline void aligned_free(void *ptr) { free(ptr); } +#define aligned_malloc(size, alignment) malloc(size) +#define aligned_free(ptr) free(ptr) #else #include -inline void *aligned_malloc(size_t size, size_t alignment) { return memalign(alignment, size); } -inline void aligned_free(void *ptr) { free(ptr); } +#define aligned_malloc(size, alignment) memalign(alignment, size) +#define aligned_free(ptr) free(ptr) #endif /* NL_COMP_ */