From: Jeff King Date: Tue, 06 Mar 2018 06:53:50 GMT Subject: Re: [PATCH 3/4] config.c: introduce 'git_config_color' to parse ANSI colors Message-ID: <20180306065349.GD3522@sigill.intra.peff.net> In-Reply-To: <20180306021729.45813-4-me@ttaylorr.com> On Mon, Mar 05, 2018 at 06:17:28PM -0800, Taylor Blau wrote: > In preparation for adding `--color` to the `git-config(1)` builtin, > let's introduce a color parsing utility, `git_config_color` in a similar > fashion to `git_config_`. Sounds good... > @@ -1000,6 +1001,15 @@ int git_config_expiry_date(timestamp_t *timestamp, const char *var, const char * > return 0; > } > > +int git_config_color(char **dest, const char *var, const char *value) > +{ > + if (!value) > + return config_error_nonbool(var); > + if (color_parse(value, *dest) < 0) > + return -1; > + return 0; > +} Why do we take a pointer-to-pointer here? We don't allocate like git_config_string() does, but instead fill in the existing buffer. -Peff