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

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

commit 8067478fcbde624a40a7a5116f318a0a0c4a61f6
Author: buxiasen <[email protected]>
AuthorDate: Fri Aug 29 23:31:21 2025 +0800

    mm/umm: unify all *USERSPACE->us_heap to USERSPACE_HEAP
    
    Reduce the dup of code, better maintenance
    
    USERSPACE_HEAP resolves to the user heap pointer in us_data, so kernel
    code can use it instead of open-coding the access.
    
    Signed-off-by: buxiasen <[email protected]>
---
 include/nuttx/mm/mm.h     | 2 +-
 include/nuttx/userspace.h | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/nuttx/mm/mm.h b/include/nuttx/mm/mm.h
index 0b0a56f3127..192039d301a 100644
--- a/include/nuttx/mm/mm.h
+++ b/include/nuttx/mm/mm.h
@@ -131,7 +131,7 @@ typedef CODE void (*mm_delaycb_t)(FAR void *mem);
  * structure from the userspace interface.
  */
 
-#  define USR_HEAP (*USERSPACE->us_data->us_heap)
+#  define USR_HEAP USERSPACE_HEAP
 
 #else
 /* Otherwise, the user heap data structures are in common .bss */
diff --git a/include/nuttx/userspace.h b/include/nuttx/userspace.h
index 039dc682e1f..4f6696798f0 100644
--- a/include/nuttx/userspace.h
+++ b/include/nuttx/userspace.h
@@ -68,6 +68,10 @@
 
 #define USERSPACE ((FAR struct userspace_s *)CONFIG_NUTTX_USERSPACE)
 
+/* Unify all USERSPCE_HEAP usage */
+
+#define USERSPACE_HEAP (*USERSPACE->us_data->us_heap)
+
 /* In user space, these functions are directly callable.  In kernel space,
  * they can be called through the userspace structure.
  */

Reply via email to