Re: [PATCH 2/3] strbuf: add strbuf_percentquote_buf
- From
Jeff King <peff@peff.net>
- Date
- Jan 13, 2010, 19:56 UTC
- Message-ID
- <20100113195635.GA25265@coredump.intra.peff.net>
- In-Reply-To
- <7vwrzln5x5.fsf@alter.siamese.dyndns.org>
On Wed, Jan 13, 2010 at 11:47:18AM -0800, Junio C Hamano wrote:
Show 10 quoted lines
> As I said, I don't think appending p-quoted version of itself to a string
> makes much sense, but I don't think in-place is too difficult.
>
> strbuf_addbuf_pquote(*dst, *src)
> {
> int len = src->len, i;
> for (i = 0; i < len; i++) {
> if (src->buf[i] == '%')
> strbuf_addch(dst, '%');
> strbuf_addch(dst, src->buf[i]);Oops, of course. I was still thinking of actually doing a single in-place conversion, not appending in-place. Of course yours is right. Can you mark up my patch instead of using the assert?
-Peff