You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/11/22 15:43:15 UTC

[incubator-nuttx] 02/02: Replace all assert() with DEBUGASSERT()

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 31c14726d5f1a87a7e3867903b6763096d15ee27
Author: Alan C. Assis <ac...@gmail.com>
AuthorDate: Sun Nov 22 10:14:36 2020 -0300

    Replace all assert() with DEBUGASSERT()
---
 arch/xtensa/src/esp32/esp32_himem.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/xtensa/src/esp32/esp32_himem.c b/arch/xtensa/src/esp32/esp32_himem.c
index c3480f7..c8c398a 100644
--- a/arch/xtensa/src/esp32/esp32_himem.c
+++ b/arch/xtensa/src/esp32/esp32_himem.c
@@ -320,7 +320,7 @@ static bool allocate_blocks(int count, uint16_t *blocks_out)
       for (i = 0; i < count; i++)
         {
           g_ram_descriptor[blocks_out[i]].is_alloced = true;
-          assert(g_ram_descriptor[blocks_out[i]].is_mapped  == false);
+          DEBUGASSERT(g_ram_descriptor[blocks_out[i]].is_mapped  == false);
         }
 
       return true;
@@ -496,11 +496,12 @@ int esp_himem_free_map_range(esp_himem_rangehandle_t handle)
 
   for (i = 0; i < handle->block_ct; i++)
     {
-      assert(rangeblock_idx_valid(handle->block_start + i));
+      DEBUGASSERT(rangeblock_idx_valid(handle->block_start + i));
 
       /* should be allocated, if handle is valid */
 
-      assert(g_range_descriptor[i + handle->block_start].is_alloced == 1);
+      DEBUGASSERT(g_range_descriptor[i + \
+                  handle->block_start].is_alloced == 1);
 
       HIMEM_CHECK(g_range_descriptor[i + handle->block_start].is_mapped,
                   "memory still mapped to range", -EINVAL);
@@ -575,7 +576,7 @@ int esp_himem_map(esp_himem_handle_t handle,
 
   for (i = 0; i < blockcount; i++)
     {
-      assert(ramblock_idx_valid(handle->block[i + ram_block]));
+      DEBUGASSERT(ramblock_idx_valid(handle->block[i + ram_block]));
       g_ram_descriptor[handle->block[i + ram_block]].is_mapped = 1;
       g_range_descriptor[range->block_start + i + range_block].is_mapped = 1;
       g_range_descriptor[range->block_start + i + range_block].ram_block =
@@ -630,7 +631,7 @@ int esp_himem_unmap(esp_himem_rangehandle_t range, void *ptr,
       int ramblock = g_range_descriptor[range->block_start + i +
                      range_block].ram_block;
 
-      assert(ramblock_idx_valid(ramblock));
+      DEBUGASSERT(ramblock_idx_valid(ramblock));
       g_ram_descriptor[ramblock].is_mapped = 0;
       g_range_descriptor[range->block_start + i + range_block].is_mapped = 0;
     }