shithub: lwext4

Download patch

ref: f0ec6ceeaa0f0d51a5f3d73d73f600fc87649acb
parent: 190cc44e4cf4486c13ee43041167490f228fb110
author: gkostka <kostka.grzegorz@gmail.com>
date: Thu Oct 29 14:32:29 EDT 2015

Refactor debug message format (CONFIG_DEBUG_PREFIX)

On some embedded devices debug printf length is limited to less
than 80 characters. It is good to have compile switch to control debug
prefix enable/disable.

--- a/lwext4/ext4_config.h
+++ b/lwext4/ext4_config.h
@@ -94,6 +94,12 @@
 #define CONFIG_DEBUG_PRINTF 1
 #endif
 
+/**@brief   Debug printf prefixes*/
+#ifndef CONFIG_DEBUG_PREFIX
+#define CONFIG_DEBUG_PREFIX 1
+#endif
+
+
 /**@brief   Assert printf enable (stdout)*/
 #ifndef CONFIG_DEBUG_ASSERT
 #define CONFIG_DEBUG_ASSERT 1
--- a/lwext4/ext4_debug.h
+++ b/lwext4/ext4_debug.h
@@ -135,13 +135,14 @@
 /**@brief   Debug printf.*/
 #define ext4_dbg(m, ...)                                                       \
 	do {                                                                   \
-		int __line = __LINE__;					       \
 		if (m & ext4_dmask_get()) {                                    \
-			printf(ext4_dmask_id2str(m));			       \
-			printf("line: %d   ", __line);			       \
-			printf(__VA_ARGS__);              		       \
+			if (CONFIG_DEBUG_PREFIX) {                             \
+				printf(ext4_dmask_id2str(m));                  \
+				printf("l: %d   ", __LINE__);                  \
+			}                                                      \
+			printf(__VA_ARGS__);                                   \
 			fflush(stdout);                                        \
-		}							       \
+		}                                                              \
 	} while (0)
 #else
 #define ext4_dbg(m, ...) do { } while (0)