From be6bc048d74779476610caa7bfb51ef0b71ba5a6 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 7 Dec 2023 02:26:11 -0500 Subject: config: use git_config_string() for core.checkRoundTripEncoding Since this code path was recently converted to check for a NULL value, it now behaves exactly like git_config_string(). We can shorten the code a bit by using that helper. Note that git_config_string() takes a const pointer, but our storage variable is non-const. We're better off making this "const", though, since the default value points to a string literal (and thus it would be an error if anybody tried to write to it). Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- config.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'config.c') diff --git a/config.c b/config.c index d997c55e33..00a11b5d98 100644 --- a/config.c +++ b/config.c @@ -1551,12 +1551,8 @@ static int git_default_core_config(const char *var, const char *value, return 0; } - if (!strcmp(var, "core.checkroundtripencoding")) { - if (!value) - return config_error_nonbool(var); - check_roundtrip_encoding = xstrdup(value); - return 0; - } + if (!strcmp(var, "core.checkroundtripencoding")) + return git_config_string(&check_roundtrip_encoding, var, value); if (!strcmp(var, "core.notesref")) { if (!value) -- cgit v1.2.3