[PATCH v3 05/13] builtin/config: pull out function to handle `--null`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pull out function to handle the `--null` option, which we are about to
reuse in subsequent commits.

Signed-off-by: Patrick Steinhardt <ps@xxxxxx>
---
 builtin/config.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/builtin/config.c b/builtin/config.c
index 693df32526..ce2d3fecd4 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -697,6 +697,14 @@ static void handle_config_location(const char *prefix)
 	}
 }
 
+static void handle_nul(void) {
+	if (end_nul) {
+		term = '\0';
+		delim = '\n';
+		key_delim = '\n';
+	}
+}
+
 static struct option builtin_config_options[] = {
 	OPT_GROUP(N_("Config file location")),
 	OPT_BOOL(0, "global", &use_global_config, N_("use global config file")),
@@ -758,12 +766,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
 			     PARSE_OPT_STOP_AT_NON_OPTION);
 
 	handle_config_location(prefix);
-
-	if (end_nul) {
-		term = '\0';
-		delim = '\n';
-		key_delim = '\n';
-	}
+	handle_nul();
 
 	if ((actions & (ACTION_GET_COLOR|ACTION_GET_COLORBOOL)) && type) {
 		error(_("--get-color and variable type are incoherent"));
-- 
2.44.GIT

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux