Thread (97 messages) 97 messages, 9 authors, 2025-08-03
STALE326d
Revisions (5)
  1. v1 [diff vs current]
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 current
  5. v5 [diff vs current]

[PATCH v4 06/14] builtin/config: pull out function to handle `--null`

From: Patrick Steinhardt <hidden>
Date: 2024-05-03 09:57:14
Subsystem: the rest · Maintainer: Linus Torvalds

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

Signed-off-by: Patrick Steinhardt <redacted>
---
 builtin/config.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/builtin/config.c b/builtin/config.c
index 8c7cd30cb4..59877065f8 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -698,6 +698,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")),
@@ -760,12 +768,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.45.0

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help