Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-09-14 01:58:08 +0400
committerJunio C Hamano <gitster@pobox.com>2011-09-14 22:56:49 +0400
commit37e8161a04360d01edd0611135f5eae8e6a08224 (patch)
treeea38f9230e77827e445d409eb4c9ea6706cb8adc /quote.h
parentc1189caeaf726e6c16c8bca7da8bf0b243da478d (diff)
quote: provide sq_dequote_to_argv_array
This is similar to sq_dequote_to_argv, but more convenient if you have an argv_array. It's tempting to just feed the components of the argv_array to sq_dequote_to_argv instead, but: 1. It wouldn't maintain the NULL-termination invariant of argv_array. 2. It doesn't match the memory ownership policy of argv_array (in which each component is free-able, not a pointer into a separate buffer). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'quote.h')
-rw-r--r--quote.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/quote.h b/quote.h
index 252b0df4b2..133155a48b 100644
--- a/quote.h
+++ b/quote.h
@@ -45,6 +45,14 @@ extern char *sq_dequote(char *);
*/
extern int sq_dequote_to_argv(char *arg, const char ***argv, int *nr, int *alloc);
+/*
+ * Same as above, but store the unquoted strings in an argv_array. We will
+ * still modify arg in place, but unlike sq_dequote_to_argv, the argv_array
+ * will duplicate and take ownership of the strings.
+ */
+struct argv_array;
+extern int sq_dequote_to_argv_array(char *arg, struct argv_array *);
+
extern int unquote_c_style(struct strbuf *, const char *quoted, const char **endp);
extern size_t quote_c_style(const char *name, struct strbuf *, FILE *, int no_dq);
extern void quote_two_c_style(struct strbuf *, const char *, const char *, int);