malloc: Make tunable callback functions static

Message ID 20210507012141.2315877-1-hjl.tools@gmail.com
State New
Headers show
Series
  • malloc: Make tunable callback functions static
Related show

Commit Message

H.J. Lu via Libc-alpha May 7, 2021, 1:21 a.m.
Since malloc tunable callback functions are only used within the same
file, we should make them static.
---
 malloc/arena.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.31.1

Comments

H.J. Lu via Libc-alpha May 7, 2021, 5:25 p.m. | #1
On 06/05/2021 22:21, H.J. Lu via Libc-alpha wrote:
> Since malloc tunable callback functions are only used within the same

> file, we should make them static.


LGTM, thanks.

> ---

>  malloc/arena.c | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

> 

> diff --git a/malloc/arena.c b/malloc/arena.c

> index 9fbbb38a15..7eb110445e 100644

> --- a/malloc/arena.c

> +++ b/malloc/arena.c

> @@ -207,7 +207,7 @@ __malloc_fork_unlock_child (void)

>  }

>  

>  #if HAVE_TUNABLES

> -void

> +static void

>  TUNABLE_CALLBACK (set_mallopt_check) (tunable_val_t *valp)

>  {

>    int32_t value = (int32_t) valp->numval;

> @@ -217,7 +217,7 @@ TUNABLE_CALLBACK (set_mallopt_check) (tunable_val_t *valp)

>  

>  # define TUNABLE_CALLBACK_FNDECL(__name, __type) \

>  static inline int do_ ## __name (__type value);				      \

> -void									      \

> +static void									      \

>  TUNABLE_CALLBACK (__name) (tunable_val_t *valp)				      \

>  {									      \

>    __type value = (__type) (valp)->numval;				      \

>

Patch

diff --git a/malloc/arena.c b/malloc/arena.c
index 9fbbb38a15..7eb110445e 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -207,7 +207,7 @@  __malloc_fork_unlock_child (void)
 }
 
 #if HAVE_TUNABLES
-void
+static void
 TUNABLE_CALLBACK (set_mallopt_check) (tunable_val_t *valp)
 {
   int32_t value = (int32_t) valp->numval;
@@ -217,7 +217,7 @@  TUNABLE_CALLBACK (set_mallopt_check) (tunable_val_t *valp)
 
 # define TUNABLE_CALLBACK_FNDECL(__name, __type) \
 static inline int do_ ## __name (__type value);				      \
-void									      \
+static void									      \
 TUNABLE_CALLBACK (__name) (tunable_val_t *valp)				      \
 {									      \
   __type value = (__type) (valp)->numval;				      \