mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/3] tlsf: enable assertions
Date: Mon,  2 Jan 2012 14:50:04 +0100	[thread overview]
Message-ID: <1325512207-16501-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1325512207-16501-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/tlsf.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/common/tlsf.c b/common/tlsf.c
index b3de976..c810e8d 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;
-- 
1.7.7.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-01-02 13:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-02 13:50 tlsf patches Sascha Hauer
2012-01-02 13:50 ` Sascha Hauer [this message]
2012-01-02 13:50 ` [PATCH] uart drivers: use xzalloc instead of xmalloc Sascha Hauer
2012-01-02 13:50 ` [PATCH 2/3] tlsf: implement malloc_stats Sascha Hauer
2012-01-02 13:50 ` [PATCH 3/3] tlsf: remove unused stuff from tlsfbits.h Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1325512207-16501-2-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox