You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/02/13 13:32:54 UTC

[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #266: Fix mm for clang

patacongo commented on a change in pull request #266: Fix mm for clang
URL: https://github.com/apache/incubator-nuttx/pull/266#discussion_r378860577
 
 

 ##########
 File path: mm/mm_heap/mm_mallinfo.c
 ##########
 @@ -97,17 +98,29 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
 
           if ((node->preceding & MM_ALLOC_BIT) != 0)
             {
+              DEBUGASSERT(node->size >= SIZEOF_MM_ALLOCNODE);
               uordblks += node->size;
             }
           else
             {
+              FAR struct mm_freenode_s *fnode;
+              DEBUGASSERT(node->size >= SIZEOF_MM_FREENODE);
+              fnode = (FAR void *)node;
+              DEBUGASSERT(fnode->blink->flink == fnode);
+              DEBUGASSERT(fnode->blink->size <= fnode->size);
+              DEBUGASSERT(fnode->flink == NULL ||
+                          fnode->flink->blink == fnode);
+              DEBUGASSERT(fnode->flink == NULL ||
+                          fnode->flink->size == 0 ||
+                          fnode->flink->size >= fnode->size);
               ordblks++;
               fordblks += node->size;
               if (node->size > mxordblk)
                 {
                   mxordblk = node->size;
                 }
             }
+          DEBUGASSERT(prev == NULL || prev->size == (node->preceding & ~MM_ALLOC_BIT));
 
 Review comment:
   Coding standard requires that all terminal right braces be followed by a blank line.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services