diff options
| author | ngkaho1234 <ngkaho1234@gmail.com> | 2015-09-26 12:59:44 +0800 |
|---|---|---|
| committer | ngkaho1234 <ngkaho1234@gmail.com> | 2015-09-26 12:59:44 +0800 |
| commit | 299dbe030a4dc518910e6a8cd2e37e640053506e (patch) | |
| tree | 031b35f77808265f45b90dde81c4a63f9b4fd509 | |
| parent | db82248ac1d7157d75763a52be0beade937605fe (diff) | |
new option: CONFIG_HAVE_OWN_ASSERT
| -rw-r--r-- | lwext4/ext4_config.h | 5 | ||||
| -rw-r--r-- | lwext4/ext4_debug.h | 22 |
2 files changed, 19 insertions, 8 deletions
diff --git a/lwext4/ext4_config.h b/lwext4/ext4_config.h index 67fd3bf..020c4a9 100644 --- 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 diff --git a/lwext4/ext4_debug.h b/lwext4/ext4_debug.h index 7af6fe3..b9d5cff 100644 --- 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 @@ uint32_t ext4_dmask_get(void); #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 |
