shithub: lwext4

Download patch

ref: 299dbe030a4dc518910e6a8cd2e37e640053506e
parent: db82248ac1d7157d75763a52be0beade937605fe
author: ngkaho1234 <ngkaho1234@gmail.com>
date: Sat Sep 26 08:59:44 EDT 2015

new option: CONFIG_HAVE_OWN_ASSERT

--- a/lwext4/ext4_config.h
+++ b/lwext4/ext4_config.h
@@ -112,6 +112,11 @@
 #define CONFIG_DEBUG_ASSERT 1
 #endif
 
+/**@brief   Include assert codes from ext4_debug or standard library.*/
+#ifndef CONFIG_HAVE_OWN_ASSERT
+#define CONFIG_HAVE_OWN_ASSERT 1
+#endif
+
 /**@brief   Statistics of block device*/
 #ifndef CONFIG_BLOCK_DEV_ENABLE_STATS
 #define CONFIG_BLOCK_DEV_ENABLE_STATS 1
--- a/lwext4/ext4_debug.h
+++ b/lwext4/ext4_debug.h
@@ -40,7 +40,10 @@
 #include "ext4_config.h"
 #include "ext4_errno.h"
 
+#if !CONFIG_HAVE_OWN_ASSERT
 #include <assert.h>
+#endif
+
 #include <stdint.h>
 #include <stdio.h>
 
@@ -102,14 +105,17 @@
 
 #if CONFIG_DEBUG_ASSERT
 /**@brief   Debug assertion.*/
-#define ext4_assert(_v)                                                        \
-	do {                                                                   \
-		if (!(_v)) {                                                   \
-			printf("Assertion failed:\nmodule: %s\nline: %d\n",    \
-			       __FILE__, __LINE__);                            \
-			assert(_v);                                            \
-		}                                                              \
-	} while (0)
+ #if CONFIG_HAVE_OWN_ASSERT
+ #define ext4_assert(_v)                                                        \
+ 	do {                                                                   \
+ 		if (!(_v)) {                                                   \
+ 			printf("Assertion failed:\nmodule: %s\nline: %d\n",    \
+ 			       __FILE__, __LINE__);                            \
+ 		}                                                              \
+ 	} while (0)
+ #else
+ #define ext4_assert(_v) assert(_v)
+ #endif
 #else
 #define ext4_assert(_v)
 #endif