# [PATCH] config: mark otherise unused function as file-scope static

4 messages from 2025-11-20 to 2025-11-20. Participants: Junio C Hamano, Ramsay Jones, brian m. carlson, Kristoffer Haugsbakk.
Thread: https://gitlist.dev/t/64517

## Junio C Hamano, 2025-11-20 19:32

Subject: [PATCH] config: mark otherise unused function as file-scope static
Message-ID: <xmqqtsyo7b4y.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqtsyo7b4y.fsf%40gitster.g

```
git_configset_get_pathname() is only used once inside config.c; we do
not have to expose it as a public function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * Not related to anything in particular, but something I noticed
   while I was in the vicinity.

 config.c | 2 +-
 config.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/config.c b/config.c
index d55882c649..1738c0cb0d 100644
--- a/config.c
+++ b/config.c
@@ -1954,7 +1954,7 @@ int git_configset_get_maybe_bool(struct config_set *set, const char *key, int *d
 		return 1;
 }
 
-int git_configset_get_pathname(struct config_set *set, const char *key, char **dest)
+static int git_configset_get_pathname(struct config_set *set, const char *key, char **dest)
 {
 	const char *value;
 	if (!git_configset_get_value(set, key, &value, NULL))
diff --git a/config.h b/config.h
index 19c87fc0bc..ba426a960a 100644
--- a/config.h
+++ b/config.h
@@ -564,7 +564,6 @@ int git_configset_get_ulong(struct config_set *cs, const char *key, unsigned lon
 int git_configset_get_bool(struct config_set *cs, const char *key, int *dest);
 int git_configset_get_bool_or_int(struct config_set *cs, const char *key, int *is_bool, int *dest);
 int git_configset_get_maybe_bool(struct config_set *cs, const char *key, int *dest);
-int git_configset_get_pathname(struct config_set *cs, const char *key, char **dest);
 
 /**
  * Run only the discover part of the repo_config_get_*() functions
-- 
2.52.0-101-g4c43c53c49


```

## Ramsay Jones, 2025-11-20 21:15

Subject: Re: [PATCH] config: mark otherise unused function as file-scope static
Message-ID: <e67ee4f6-9516-4561-b9f4-06e9049ff2ba@ramsayjones.plus.com>
URL: https://gitlist.dev/e/e67ee4f6-9516-4561-b9f4-06e9049ff2ba%40ramsayjones.plus.com
In-Reply-To: <xmqqtsyo7b4y.fsf@gitster.g>

```


On 20/11/2025 7:32 pm, Junio C Hamano wrote:
> git_configset_get_pathname() is only used once inside config.c; we do
> not have to expose it as a public function.
> 
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> 
>  * Not related to anything in particular, but something I noticed
>    while I was in the vicinity.
> 
>  config.c | 2 +-
>  config.h | 1 -
>  2 files changed, 1 insertion(+), 2 deletions(-)
> 

Similarly, not related to anything, but ...

I have been meaning (for years and years) to look at all of the symbols
that my 'static-check.pl' script produces to see if any of them can be
treated similarly. Note that there are a few ('sc' for master branch,
'nsc' for next branch and 'ssc' for seen branch):

  $ wc -l sc nsc ssc
    102 sc
    102 nsc
    120 ssc
    324 total
  $ 

The symbols from config.o:

  $ grep config.o sc
  config.o	- git_config_from_parameters
  config.o	- git_configset_get_bool_or_int
  config.o	- git_configset_get_int
  config.o	- git_configset_get_maybe_bool
  config.o	- git_configset_get_pathname
  config.o	- git_configset_get_string
  config.o	- git_configset_get_ulong
  config.o	- git_die_config_linenr
  config.o	- repo_config_copy_section_in_file
  config.o	- repo_config_get_bool_or_int
  config.o	- repo_config_set_multivar_in_file
  $ 

Note that the 'seen' branch add quite a few new symbols:

  $ diff nsc ssc
  0a1,2
  > add-interactive.o	- clear_add_i_state
  > add-interactive.o	- init_add_i_state
  38a41,44
  > hash.o	- git_hash_alloc
  > hash.o	- git_hash_free
  > hash.o	- git_hash_init
  > hash.o	- hash_algo_ptr_by_number
  52a59
  > packfile.o	- mark_bad_packed_object
  54d60
  < packfile.o	- packfile_store_close
  84a91
  > setup.o	- check_repository_format
  85a93
  > setup.o	- setup_git_env
  99a108,117
  > trailer.o	- blank_line_before_trailer_block
  > trailer.o	- format_trailers
  > trailer.o	- free_trailers
  > trailer.o	- parse_trailers
  > trailer.o	- parse_trailers_from_command_line_args
  > trailer.o	- parse_trailers_from_config
  > trailer.o	- process_trailers_lists
  > trailer.o	- trailer_block_end
  > trailer.o	- trailer_block_release
  > trailer.o	- trailer_block_start
  $ 
 

ATB,
Ramsay Jones

 

```

## brian m. carlson, 2025-11-20 22:27

Subject: Re: [PATCH] config: mark otherise unused function as file-scope static
Message-ID: <aR-V45lWv6kYSe5b@fruit.crustytoothpaste.net>
URL: https://gitlist.dev/e/aR-V45lWv6kYSe5b%40fruit.crustytoothpaste.net
In-Reply-To: <e67ee4f6-9516-4561-b9f4-06e9049ff2ba@ramsayjones.plus.com>

```
On 2025-11-20 at 21:15:57, Ramsay Jones wrote:
>   $ diff nsc ssc
>   0a1,2
>   > add-interactive.o	- clear_add_i_state
>   > add-interactive.o	- init_add_i_state
>   38a41,44
>   > hash.o	- git_hash_alloc
>   > hash.o	- git_hash_free
>   > hash.o	- git_hash_init
>   > hash.o	- hash_algo_ptr_by_number

These are called from Rust code so they must be public.  They may not be
used elsewhere in your branch if you have not compiled with Rust,
though.
-- 
brian m. carlson (they/them)
Toronto, Ontario, CA

```

## Kristoffer Haugsbakk, 2025-11-20 23:01

Subject: Re: [PATCH] config: mark otherise unused function as file-scope static
Message-ID: <df6a2498-a03c-4392-8091-50220db5f108@app.fastmail.com>
URL: https://gitlist.dev/e/df6a2498-a03c-4392-8091-50220db5f108%40app.fastmail.com
In-Reply-To: <xmqqtsyo7b4y.fsf@gitster.g>

```
> config: mark otherise unused function as file-scope static

s/otherise/otherwise/

-- 
Kristoffer Haugsbakk

```
