git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] quote: drop sq_dequote_to_argv()

From
Jeff King <peff@peff.net>
Date
May 19, 2026, 01:19 UTC
Message-ID
<20260519011934.GB1615870@coredump.intra.peff.net>
In-Reply-To
<20260519011837.GA1615637@coredump.intra.peff.net>

The last caller went away in f9dbb64fad (config: parse more robust format in GIT_CONFIG_PARAMETERS, 2021-01-12), when we switched to using sq_dequote_step().

The "to_argv()" form is not a great interface. If you care about raw speed, then sq_dequote_step() lets you work incrementally without extra allocations. If you care about simplicity, then sq_dequote_to_strvec() puts the result in an encapsulated data structure. With sq_dequote_to_argv(), you have a data dependency on the original string but still have to remember to manually free the argv array itself (but not its elements).

So it's sort of a worst-of-both-worlds middle ground. Let's get rid of it.

Signed-off-by: Jeff King <peff@peff.net>
---
 quote.c |  5 -----
 quote.h | 12 +++---------
 2 files changed, 3 insertions(+), 14 deletions(-)
diff --git a/quote.c b/quote.c
index b9f6bdc775..cff78af3a4 100644
--- a/quote.c
+++ b/quote.c
@@ -202,11 +202,6 @@ static int sq_dequote_to_argv_internal(char *arg,
 	return 0;
 }
 
-int sq_dequote_to_argv(char *arg, const char ***argv, int *nr, int *alloc)
-{
-	return sq_dequote_to_argv_internal(arg, argv, nr, alloc, NULL);
-}
-
 int sq_dequote_to_strvec(char *arg, struct strvec *array)
 {
 	return sq_dequote_to_argv_internal(arg, NULL, NULL, NULL, array);
diff --git a/quote.h b/quote.h
index 400397b11a..989f2388c0 100644
--- a/quote.h
+++ b/quote.h
@@ -68,15 +68,9 @@ char *sq_dequote_step(char *src, char **next);
 
 /*
  * Same as the above, but can be used to unwrap many arguments in the
- * same string separated by space. Like sq_quote, it works in place,
- * modifying arg and appending pointers into it to argv.
- */
-int sq_dequote_to_argv(char *arg, const char ***argv, int *nr, int *alloc);
-
-/*
- * Same as above, but store the unquoted strings in a strvec. We will
- * still modify arg in place, but unlike sq_dequote_to_argv, the strvec
- * will duplicate and take ownership of the strings.
+ * same string separated by space. The strvec will duplicate and take
+ * ownership of the strings, but note that "arg" is still modified in-place
+ * during parsing.
  */
 int sq_dequote_to_strvec(char *arg, struct strvec *);
 
-- 
2.54.0.524.g198262df96
Previous: Jeff KingNext: Jeff King
Message 3 of 6 in “small quote.[ch] cleanup”
  1. 0/3 small quote.[ch] cleanupJeff King, May 19, 2026
  2. 1/3 quote.h: bump strvec forward declaration to the topJeff King, May 19, 2026
  3. 2/3 quote: drop sq_dequote_to_argv()Jeff King, May 19, 2026
  4. 3/3 quote: simplify internals of dequotingJeff King, May 19, 2026
  5. Junio C HamanoMay 19, 2026
  6. Patrick SteinhardtMay 21, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.