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

janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git


The following commit(s) were added to refs/heads/master by this push:
     new 25bf03e1f nimble/porting: Fix OS_MEMPOOL_SIZE() macro
25bf03e1f is described below

commit 25bf03e1fab0c96a996a3d2dc8e6e14520edc874
Author: Donatien Garnier <donatien.garn...@blecon.net>
AuthorDate: Fri Apr 12 16:52:08 2024 +0100

    nimble/porting: Fix OS_MEMPOOL_SIZE() macro
    
    The OS_MEMPOOL_SIZE() macro returns an invalid
    size when guards are used (an additional 4 bytes
    must be reserved for each block, which is not done
    at the moment). Correct this in line with the
    macro defined in mynewt core.
---
 porting/nimble/include/os/os_mempool.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/porting/nimble/include/os/os_mempool.h 
b/porting/nimble/include/os/os_mempool.h
index 71d77065a..74bc43fe0 100644
--- a/porting/nimble/include/os/os_mempool.h
+++ b/porting/nimble/include/os/os_mempool.h
@@ -164,7 +164,7 @@ typedef __uint128_t os_membuf_t;
 #else
 #error "Unhandled `OS_ALIGNMENT` for `os_membuf_t`"
 #endif /* OS_ALIGNMENT == * */
-#define OS_MEMPOOL_SIZE(n,blksize)      ((((blksize) + ((OS_ALIGNMENT)-1)) / 
(OS_ALIGNMENT)) * (n))
+#define OS_MEMPOOL_SIZE(n,blksize)      (((OS_MEMPOOL_BLOCK_SZ(blksize) + 
((OS_ALIGNMENT)-1)) / (OS_ALIGNMENT)) * (n))
 
 /** Calculates the number of bytes required to initialize a memory pool. */
 #define OS_MEMPOOL_BYTES(n,blksize)     \

Reply via email to