config: mark otherise unused function as file-scope static
PATCH 1/1 config: mark otherise unused function as file-scope static
git_configset_get_pathname() is only used once inside config.c; we do not have to expose it as a public function.
---
* 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(-)
config.c +1 -1
@@ -1954,7 +1954,7 @@ int git_configset_get_maybe_bool(struct config_set *set, const char *key, int *dreturn 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 ))
config.h +0 -1
@@ -564,7 +564,6 @@ int git_configset_get_ulong(struct config_set *cs, const char *key, unsigned lonint 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
Signature · 1 line
2.52.0-101-g4c43c53c49
Quoted 4 lines · Junio C Hamano
git_configset_get_pathname()is only used once insideconfig.c; we do not have to expose it as a public function.Signed-off-by Junio C Hamano <[email protected]>
Quoted 9 lines
---
* 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
Quoted 2 lines
add-interactive.o -
clear_add_i_state
add-interactive.o -init_add_i_state
38a41,44
Quoted 4 lines
hash.o -
git_hash_alloc
hash.o -git_hash_free
hash.o -git_hash_init
hash.o -hash_algo_ptr_by_number
52a59
Quoted 1 line
packfile.o -
mark_bad_packed_object
54d60
< packfile.o - packfile_store_close
84a91
Quoted 1 line
setup.o -
check_repository_format
85a93
Quoted 1 line
setup.o -
setup_git_env
99a108,117
Quoted 10 lines
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
Quoted 9 lines · Ramsay Jones
$ diff nsc ssc 0a1,2Quoted 2 lines
add-interactive.o -
clear_add_i_state
add-interactive.o -init_add_i_state38a41,44
Quoted 4 lines
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.
Signature · 2 lines
brian m. carlson (they/them) Toronto, Ontario, CA
Quoted 1 line
config: mark otherise unused function as file-scope static
s/otherise/otherwise/
Signature · 1 line
Kristoffer Haugsbakk