[rtems commit] malloc: Hide RTEMS_Malloc_Sbrk_amount

Sebastian Huber sebh at rtems.org
Tue Apr 20 17:18:32 UTC 2021


Module:    rtems
Branch:    master
Commit:    6c66bbbadf4bbcb0efc5bda992f638feadfb69e5
Changeset: http://git.rtems.org/rtems/commit/?id=6c66bbbadf4bbcb0efc5bda992f638feadfb69e5

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Apr 20 09:58:06 2021 +0200

malloc: Hide RTEMS_Malloc_Sbrk_amount

Move RTEMS_Malloc_Sbrk_amount to the only implementation file which uses
it and make it private to hide implementation-details from an API
header.

---

 cpukit/include/rtems/malloc.h                       | 7 +------
 cpukit/libcsupport/src/rtems_heap_extend_via_sbrk.c | 7 ++++++-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/cpukit/include/rtems/malloc.h b/cpukit/include/rtems/malloc.h
index ec6473a..eba538e 100644
--- a/cpukit/include/rtems/malloc.h
+++ b/cpukit/include/rtems/malloc.h
@@ -48,12 +48,7 @@ Heap_Control *RTEMS_Malloc_Initialize(
   Heap_Initialization_or_extend_handler  extend
 );
 
-extern ptrdiff_t RTEMS_Malloc_Sbrk_amount;
-
-static inline void rtems_heap_set_sbrk_amount( ptrdiff_t sbrk_amount )
-{
-  RTEMS_Malloc_Sbrk_amount = sbrk_amount;
-}
+void rtems_heap_set_sbrk_amount( ptrdiff_t sbrk_amount );
 
 typedef void *(*rtems_heap_extend_handler)(
   Heap_Control *heap,
diff --git a/cpukit/libcsupport/src/rtems_heap_extend_via_sbrk.c b/cpukit/libcsupport/src/rtems_heap_extend_via_sbrk.c
index 6bb896a..da7896c 100644
--- a/cpukit/libcsupport/src/rtems_heap_extend_via_sbrk.c
+++ b/cpukit/libcsupport/src/rtems_heap_extend_via_sbrk.c
@@ -29,7 +29,12 @@
 
 #include "malloc_p.h"
 
-ptrdiff_t RTEMS_Malloc_Sbrk_amount;
+static ptrdiff_t RTEMS_Malloc_Sbrk_amount;
+
+void rtems_heap_set_sbrk_amount( ptrdiff_t sbrk_amount )
+{
+  RTEMS_Malloc_Sbrk_amount = sbrk_amount;
+}
 
 void *rtems_heap_extend_via_sbrk(
   Heap_Control *heap,



More information about the vc mailing list