summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-12-23 00:54:28 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-12-23 11:29:10 +0100
commit2467c61b3b1860339defc2b120e46c1aa8721aaf (patch)
treea56b105fea6a9bc6303f2650cb390185e0625141
parentb25bb1f0726bf81aa1af52bd1eca63b51c907bcf (diff)
downloadbarebox-2467c61b3b1860339defc2b120e46c1aa8721aaf.tar.gz
barebox-2467c61b3b1860339defc2b120e46c1aa8721aaf.tar.xz
tlsf: enable assertions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/tlsf.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/common/tlsf.c b/common/tlsf.c
index b3de9765c4..c810e8dafe 100644
--- a/common/tlsf.c
+++ b/common/tlsf.c
@@ -1,20 +1,17 @@
-#ifndef __BAREBOX__
-#include <assert.h>
-#include <limits.h>
-#endif
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <linux/stringify.h>
#include "tlsf.h"
#include "tlsfbits.h"
-#ifdef __BAREBOX__
-#ifndef _DEBUG
-#define _DEBUG 0
-#endif
-#define tlsf_assert(expr) ((void) (0))
+#ifdef DEBUG
+#define tlsf_assert(expr) \
+ ((expr) ? (void)(0) : printf("%s\n", __stringify(expr)))
+#else
+#define tlsf_assert(expr) (void)(0)
#endif
/*
@@ -759,7 +756,7 @@ tlsf_pool tlsf_create(void* mem, size_t bytes)
const size_t pool_bytes = align_down(bytes - pool_overhead, ALIGN_SIZE);
pool_t* pool = tlsf_cast(pool_t*, mem);
-#if _DEBUG
+#ifdef DEBUG
/* Verify ffs/fls work properly. */
int rv = 0;
rv += (tlsf_ffs(0) == -1) ? 0 : 0x1;