Re: [PATCH v2 01/19] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
On Wed, Jun 11, 2014 at 04:42:56AM -0400, Eric Sunshine wrote: On Mon, Jun 9, 2014 at 6:19 PM, Jeremiah Mahler jmmah...@gmail.com wrote: Currently, the data in a strbuf is modified using add operations. To set the buffer to some data a reset must be performed before an add.

Re: [PATCH v2 01/19] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
Michael, On Wed, Jun 11, 2014 at 02:05:35PM +0200, Michael Haggerty wrote: On 06/10/2014 12:19 AM, Jeremiah Mahler wrote: Currently, the data in a strbuf is modified using add operations. To set the buffer to some data a reset must be performed before an add. ... diff --git a/strbuf.c

Re: [PATCH v2 01/19] add strbuf_set operations

2014-06-12 Thread Michael Haggerty
On 06/12/2014 09:10 AM, Jeremiah Mahler wrote: On Wed, Jun 11, 2014 at 02:05:35PM +0200, Michael Haggerty wrote: [...] If there were a function like strbuf_grow_to(sb, len): void strbuf_grow_to(struct strbuf *sb, size_t len) { int new_buf = !sb-alloc; if

Re: [PATCH v2 01/19] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
Michael, On Thu, Jun 12, 2014 at 12:21:48PM +0200, Michael Haggerty wrote: On 06/12/2014 09:10 AM, Jeremiah Mahler wrote: On Wed, Jun 11, 2014 at 02:05:35PM +0200, Michael Haggerty wrote: [...] If there were a function like strbuf_grow_to(sb, len): void strbuf_grow_to(struct strbuf

Re: [PATCH v2 01/19] add strbuf_set operations

2014-06-11 Thread Eric Sunshine
On Mon, Jun 9, 2014 at 6:19 PM, Jeremiah Mahler jmmah...@gmail.com wrote: Currently, the data in a strbuf is modified using add operations. To set the buffer to some data a reset must be performed before an add. strbuf_reset(buf); strbuf_add(buf, cb.buf.buf, cb.buf.len); And this is a

Re: [PATCH v2 01/19] add strbuf_set operations

2014-06-11 Thread Michael Haggerty
On 06/10/2014 12:19 AM, Jeremiah Mahler wrote: Currently, the data in a strbuf is modified using add operations. To set the buffer to some data a reset must be performed before an add. strbuf_reset(buf); strbuf_add(buf, cb.buf.buf, cb.buf.len); And this is a common sequence of

[PATCH v2 01/19] add strbuf_set operations

2014-06-09 Thread Jeremiah Mahler
Currently, the data in a strbuf is modified using add operations. To set the buffer to some data a reset must be performed before an add. strbuf_reset(buf); strbuf_add(buf, cb.buf.buf, cb.buf.len); And this is a common sequence of operations with 70 occurrences found in the current source