builtin/apply.c: replace `git_config()` with `git_config_get_string_const()`

Use `git_config_get_string_const()` instead of `git_config()` to take advantage of the config-set API which provides a cleaner control flow. Signed-off-by: Tanay Abhra <tanayabh@gmail.com> Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Tanay Abhra committed Aug 13, 2014 at 01:22 UTC b35b10d463fbc274a2edd006f6f5ab46e66a4722
1 file changed +5 -7
builtin/apply.c
+5 -7
@@ -4269,13 +4269,11 @@ static int apply_patch(int fd, const char *filename, int options)
4269 return 0;
4270 }
4271
4272 -static int git_apply_config(const char *var, const char *value, void *cb)
4272 +static void git_apply_config(void)
4273 {
4274 - if (!strcmp(var, "apply.whitespace"))
4275 - return git_config_string(&apply_default_whitespace, var, value);
4276 - else if (!strcmp(var, "apply.ignorewhitespace"))
4277 - return git_config_string(&apply_default_ignorewhitespace, var, value);
4278 - return git_default_config(var, value, cb);
4274 + git_config_get_string_const("apply.whitespace", &apply_default_whitespace);
4275 + git_config_get_string_const("apply.ignorewhitespace", &apply_default_ignorewhitespace);
4276 + git_config(git_default_config, NULL);
4277 }
4278
4279 static int option_parse_exclude(const struct option *opt,
@@ -4423,7 +4421,7 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
4421
4422 prefix = prefix_;
4423 prefix_length = prefix ? strlen(prefix) : 0;
4426 - git_config(git_apply_config, NULL);
4424 + git_apply_config();
4425 if (apply_default_whitespace)
4426 parse_whitespace_option(apply_default_whitespace);
4427 if (apply_default_ignorewhitespace)