Re: [RFC PATCH 1/2] config: make git_config_include() static
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Oct 13, 2021, 08:26 UTC
- Message-ID
- <87sfx5ib3h.fsf@evledraar.gmail.com>
- In-Reply-To
- <179df6d6adfe460de7413e1fb1dff6bce185ae0e.1634077795.git.jonathantanmy@google.com>
On Tue, Oct 12 2021, Jonathan Tan wrote:
Show 25 quoted lines
> It is not used from outside the file in which it is declared.
>
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
> config.c | 12 +++++++++++-
> config.h | 37 ++++---------------------------------
> 2 files changed, 15 insertions(+), 34 deletions(-)
>
> diff --git a/config.c b/config.c
> index 2edf835262..365d57833b 100644
> --- a/config.c
> +++ b/config.c
> @@ -120,6 +120,16 @@ static long config_buf_ftell(struct config_source *conf)
> return conf->u.buf.pos;
> }
>
> +struct config_include_data {
> + int depth;
> + config_fn_t fn;
> + void *data;
> + const struct config_options *opts;
> +};
> +#define CONFIG_INCLUDE_INIT { 0 }
> +
> +static int git_config_include(const char *var, const char *value, void *data);Can't we just move the function here?
Show 9 quoted lines
> #define MAX_INCLUDE_DEPTH 10 > static const char include_depth_advice[] = N_( > "exceeded maximum include depth (%d) while including\n" > @@ -306,7 +316,7 @@ static int include_condition_is_true(const struct config_options *opts, > return 0; > } > > -int git_config_include(const char *var, const char *value, void *data) > +static int git_config_include(const char *var, const char *value, void *data)
...and avoid the forward declaration?
I've seen that in a few places, making the diff smaller here doesn't seem worth it v.s. maintaining the definition in two places.