From fac3ff38c2f0a4eecbb7ec2ca86cdd0d30c0a1a0 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 9 Mar 2012 15:31:45 -0800 Subject: [PATCH] reformat DEBUG messages --- libthreads.c | 2 -- libthreads.h | 8 +++++--- schedule.c | 4 +--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/libthreads.c b/libthreads.c index bd7f501d..959fb772 100644 --- a/libthreads.c +++ b/libthreads.c @@ -1,8 +1,6 @@ #include #include -//#define CONFIG_DEBUG - #include "libthreads.h" #define STACK_SIZE (1024 * 1024) diff --git a/libthreads.h b/libthreads.h index 3324fccf..a25b2779 100644 --- a/libthreads.h +++ b/libthreads.h @@ -4,12 +4,14 @@ #include #include +//#define CONFIG_DEBUG + #ifdef CONFIG_DEBUG -#define DBG() do { printf("Here: %s, L%d\n", __func__, __LINE__); } while (0) -#define DEBUG(fmt, ...) printf(fmt, ##__VA_ARGS__) +#define DEBUG(fmt, ...) do { printf("*** %25s(): line %-4d *** " fmt, __func__, __LINE__, ##__VA_ARGS__); } while (0) +#define DBG() DEBUG("\n"); #else -#define DBG() #define DEBUG(fmt, ...) +#define DBG() #endif struct thread { diff --git a/schedule.c b/schedule.c index e940f5aa..f5ce6448 100644 --- a/schedule.c +++ b/schedule.c @@ -1,5 +1,3 @@ -//#define CONFIG_DEBUG - #include "schedule.h" struct thread_list_node { @@ -46,7 +44,7 @@ static int dequeue_thread(struct thread **t) void schedule_add_thread(struct thread *t) { - DEBUG("%s: thread %d\n", __func__, t->index); + DEBUG("thread %d\n", t->index); enqueue_thread(t); } -- 2.34.1