git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Christian Couder <chriscool@tuxfamily.org>
Cc: git@vger.kernel.org, John Tapsell <johnflux@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH 1/4] quote: implement "sq_dequote_many" to unwrap many args in one string
Date: Sun, 29 Mar 2009 23:45:01 -0700	[thread overview]
Message-ID: <7vocvjjyqa.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 20090329114444.5579813c.chriscool@tuxfamily.org

Christian Couder <chriscool@tuxfamily.org> writes:

> @@ -92,6 +92,8 @@ char *sq_dequote(char *arg)
>  		switch (*++src) {
>  		case '\0':
>  			*dst = 0;
> +			if (next)
> +				*next = 0;

	*next = NULL;

>  			return arg;
>  		case '\\':
>  			c = *++src;



> diff --git a/quote.h b/quote.h
> index c5eea6f..c2f98e7 100644
> --- a/quote.h
> +++ b/quote.h
> @@ -39,6 +39,14 @@ extern void sq_quote_argv(struct strbuf *, const char **argv, size_t maxlen);
>   */
>  extern char *sq_dequote(char *);
>  
> +/*
> + * Same as the above, but can unwraps many arguments in the same string

"can unwrap"

> + * separated by space. "next" is changed to point to the next argument
> + * that should be passed as first parameter. When there are no more
> + * arguments to be dequoted, then "next" is changed to point to NULL.
> + */
> +extern char *sq_dequote_many(char *arg, char **next);
> +
>  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);

I think dequote_many() is misnamed, as it only does one but has a slightly
more helpful interface than the bare sq_dequote() when the caller is
willing to dequote many.  It probably should be called dequote_step().

But do not send in replacements just yet.

  reply	other threads:[~2009-03-30  6:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-29  9:44 [PATCH 1/4] quote: implement "sq_dequote_many" to unwrap many args in one string Christian Couder
2009-03-30  6:45 ` Junio C Hamano [this message]
2009-03-31  5:04   ` Christian Couder
2009-03-31  5:09     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vocvjjyqa.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=johnflux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).