builtin/config: pull out function to handle `--null`

Pull out function to handle the `--null` option, which we are about to reuse in subsequent commits. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed May 6, 2024 at 10:56 UTC fee3796616263772cc79ee2bef40faf47799cef9
1 file changed +9 -6
builtin/config.c
+9 -6
@@ -698,6 +698,14 @@ static void handle_config_location(const char *prefix)
698 }
699 }
700
701 +static void handle_nul(void) {
702 + if (end_nul) {
703 + term = '\0';
704 + delim = '\n';
705 + key_delim = '\n';
706 + }
707 +}
708 +
709 static struct option builtin_config_options[] = {
710 OPT_GROUP(N_("Config file location")),
711 OPT_BOOL(0, "global", &use_global_config, N_("use global config file")),
@@ -760,12 +768,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
768 PARSE_OPT_STOP_AT_NON_OPTION);
769
770 handle_config_location(prefix);
763 -
764 - if (end_nul) {
765 - term = '\0';
766 - delim = '\n';
767 - key_delim = '\n';
768 - }
771 + handle_nul();
772
773 if ((actions & (ACTION_GET_COLOR|ACTION_GET_COLORBOOL)) && type) {
774 error(_("--get-color and variable type are incoherent"));