summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntony Pavlov <antonynpavlov@gmail.com>2011-12-08 18:03:48 +0400
committerSascha Hauer <s.hauer@pengutronix.de>2011-12-23 11:26:42 +0100
commit282af094a6ec8e5eab5e134704fe2e0da0eef9f2 (patch)
tree75a43ae7b626ee0f6aec3d037de34f1dd3b0ef13
parentd5b733a6449e6c285309880cdb65933a21ba5a76 (diff)
downloadbarebox-282af094a6ec8e5eab5e134704fe2e0da0eef9f2.tar.gz
barebox-282af094a6ec8e5eab5e134704fe2e0da0eef9f2.tar.xz
adapt tlsf for barebox
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/tlsf.c11
-rw-r--r--include/tlsf.h2
2 files changed, 12 insertions, 1 deletions
diff --git a/common/tlsf.c b/common/tlsf.c
index 02dc8d44a8..b3de9765c4 100644
--- a/common/tlsf.c
+++ b/common/tlsf.c
@@ -1,5 +1,7 @@
+#ifndef __BAREBOX__
#include <assert.h>
#include <limits.h>
+#endif
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
@@ -8,6 +10,13 @@
#include "tlsf.h"
#include "tlsfbits.h"
+#ifdef __BAREBOX__
+#ifndef _DEBUG
+#define _DEBUG 0
+#endif
+#define tlsf_assert(expr) ((void) (0))
+#endif
+
/*
** Constants.
*/
@@ -82,6 +91,7 @@ enum tlsf_private
#define tlsf_static_assert(exp) \
typedef char _tlsf_glue(static_assert, __LINE__) [(exp) ? 1 : -1]
+#ifndef __BAREBOX__
/* This code has been tested on 32- and 64-bit (LP/LLP) architectures. */
tlsf_static_assert(sizeof(int) * CHAR_BIT == 32);
tlsf_static_assert(sizeof(size_t) * CHAR_BIT >= 32);
@@ -92,6 +102,7 @@ tlsf_static_assert(sizeof(unsigned int) * CHAR_BIT >= SL_INDEX_COUNT);
/* Ensure we've properly tuned our sizes. */
tlsf_static_assert(ALIGN_SIZE == SMALL_BLOCK_SIZE / SL_INDEX_COUNT);
+#endif
/*
** Data structures and associated constants.
diff --git a/include/tlsf.h b/include/tlsf.h
index de7f90b54f..d575e165bf 100644
--- a/include/tlsf.h
+++ b/include/tlsf.h
@@ -43,7 +43,7 @@ int tlsf_check_heap(tlsf_pool pool);
size_t tlsf_block_size(void* ptr);
/* Overhead of per-pool internal structures. */
-size_t tlsf_overhead();
+size_t tlsf_overhead(void);
#if defined(__cplusplus)
};