Typo introduced #2f50b47

Kian Kasad kian at kasad.com
Sun Aug 4 03:01:57 UTC 2024


> On Aug 3, 2024, at 14:52, Alexander Pickering <alex at cogarr.net> wrote:
> 
> ../scan-tree.c:57:65: error: parameter name omitted
>   57 | ic int gitconfig_config(const char *key, const char *value,
> const struct config_context *, void *cb)
> 
> I think this line
> 
> 	static int gitconfig_config(const char *key, const char *value, const struct config_context *, void *cb)
> 
> should be
> 
> 	static int gitconfig_config(const char *key, const char *value, void *cb)

I agree that that’s a mistake, but I disagree with your suggested change.

The gitconfig_config() function is passed as the first argument to the
git_config_from_file() function which is defined in git/config.c. That function
expects the first argument to be of type config_fn_t, which does have the
context argument. This is why it was added to gitconfig_config(). Therefore, the
proper solution is to just give that argument a name, as removing it completely
could cause further errors:

	static int gitconfig_config(const char *key, const char *value, const struct config_context *UNUSED, void *cb)

Git seems to use the name “UNUSED” which is why I have followed suit here.

-- 
Kian Kasad
kian at kasad.com <mailto:kian at kasad.com>
(925) 871-9823 <tel:+19258719823>


More information about the CGit mailing list