git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] config: mark otherise unused function as file-scope static
@ 2025-11-20 19:32 Junio C Hamano
  2025-11-20 21:15 ` Ramsay Jones
  2025-11-20 23:01 ` Kristoffer Haugsbakk
  0 siblings, 2 replies; 4+ messages in thread
From: Junio C Hamano @ 2025-11-20 19:32 UTC (permalink / raw)
  To: git

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] config: mark otherise unused function as file-scope static
  2025-11-20 19:32 [PATCH] config: mark otherise unused function as file-scope static Junio C Hamano
@ 2025-11-20 21:15 ` Ramsay Jones
  2025-11-20 22:27   ` brian m. carlson
  2025-11-20 23:01 ` Kristoffer Haugsbakk
  1 sibling, 1 reply; 4+ messages in thread
From: Ramsay Jones @ 2025-11-20 21:15 UTC (permalink / raw)
  To: Junio C Hamano, git



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

 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] config: mark otherise unused function as file-scope static
  2025-11-20 21:15 ` Ramsay Jones
@ 2025-11-20 22:27   ` brian m. carlson
  0 siblings, 0 replies; 4+ messages in thread
From: brian m. carlson @ 2025-11-20 22:27 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Junio C Hamano, git

[-- Attachment #1: Type: text/plain, Size: 522 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] config: mark otherise unused function as file-scope static
  2025-11-20 19:32 [PATCH] config: mark otherise unused function as file-scope static Junio C Hamano
  2025-11-20 21:15 ` Ramsay Jones
@ 2025-11-20 23:01 ` Kristoffer Haugsbakk
  1 sibling, 0 replies; 4+ messages in thread
From: Kristoffer Haugsbakk @ 2025-11-20 23:01 UTC (permalink / raw)
  To: Junio C Hamano, git

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

s/otherise/otherwise/

-- 
Kristoffer Haugsbakk

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-11-20 23:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-20 19:32 [PATCH] config: mark otherise unused function as file-scope static Junio C Hamano
2025-11-20 21:15 ` Ramsay Jones
2025-11-20 22:27   ` brian m. carlson
2025-11-20 23:01 ` Kristoffer Haugsbakk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).