malloc: Make tunable callback functions static

Message ID 20210507012141.2315877-1-hjl.tools@gmail.com
State Committed
Commit 310be3cc09d5b1471174bc12f1860169e686bd65
Headers
Series malloc: Make tunable callback functions static |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

H.J. Lu May 7, 2021, 1:21 a.m. UTC
  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(-)
  

Comments

Adhemerval Zanella Netto May 7, 2021, 5:25 p.m. UTC | #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;				      \