From 0e52776ecb671ccc0d2ce4e13550d02f4379ebfc Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sun, 1 Sep 2013 17:02:11 +0200 Subject: [PATCH] Renames ALIGN to avoid conflicts in some architectures. --- util.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/util.c b/util.c index cfec84a5..adca959c 100644 --- a/util.c +++ b/util.c @@ -1323,19 +1323,23 @@ void* malloc_nofail(size_t size) return ptr; } -#define ALIGN 256 +/** + * Memory alignment provided by malloc_nofail_align(). + * It should guarantee good cache performance everywhere. + */ +#define MALLOC_NOFAIL_ALIGN 256 void* malloc_nofail_align(size_t size, void** freeptr) { - unsigned char* ptr = malloc_nofail(size + ALIGN); + unsigned char* ptr = malloc_nofail(size + MALLOC_NOFAIL_ALIGN); uintptr_t offset; *freeptr = ptr; - offset = ((uintptr_t)ptr) % ALIGN; + offset = ((uintptr_t)ptr) % MALLOC_NOFAIL_ALIGN; if (offset != 0) { - ptr += ALIGN - offset; + ptr += MALLOC_NOFAIL_ALIGN - offset; } return ptr;