Code

Merge branch 'maint-1.6.3' into maint
[git.git] / quote.c
diff --git a/quote.c b/quote.c
index ea49c7a99fb1fc28f786d53f528addf4dcbf5a02..848d174cc56be32483ba6c73f9b06bc398ed6437 100644 (file)
--- a/quote.c
+++ b/quote.c
@@ -120,6 +120,23 @@ char *sq_dequote(char *arg)
        return sq_dequote_step(arg, NULL);
 }
 
+int sq_dequote_to_argv(char *arg, const char ***argv, int *nr, int *alloc)
+{
+       char *next = arg;
+
+       if (!*arg)
+               return 0;
+       do {
+               char *dequoted = sq_dequote_step(next, &next);
+               if (!dequoted)
+                       return -1;
+               ALLOC_GROW(*argv, *nr + 1, *alloc);
+               (*argv)[(*nr)++] = dequoted;
+       } while (next);
+
+       return 0;
+}
+
 /* 1 means: quote as octal
  * 0 means: quote as octal if (quote_path_fully)
  * -1 means: never quote
@@ -255,8 +272,8 @@ void write_name_quoted(const char *name, FILE *fp, int terminator)
        fputc(terminator, fp);
 }
 
-extern void write_name_quotedpfx(const char *pfx, size_t pfxlen,
-                                 const char *name, FILE *fp, int terminator)
+void write_name_quotedpfx(const char *pfx, size_t pfxlen,
+                         const char *name, FILE *fp, int terminator)
 {
        int needquote = 0;