Re: [PATCH 1/2] strbuf: add xstrdup_fmt helper

2014-06-19 Thread René Scharfe
Am 19.06.2014 11:05, schrieb Jeff King: On Wed, Jun 18, 2014 at 03:32:08PM -0700, Junio C Hamano wrote: str = xstrdup_fmt(fmt, some, args); --- I'm open to suggestions on the name. This really is the same thing conceptually as the GNU asprintf(), but the interface is different (that function

Re: [PATCH 1/2] strbuf: add xstrdup_fmt helper

2014-06-19 Thread Junio C Hamano
Jeff King writes: > On Wed, Jun 18, 2014 at 03:32:08PM -0700, Junio C Hamano wrote: > >> > str = xstrdup_fmt(fmt, some, args); >> > --- >> > I'm open to suggestions on the name. This really is the same thing >> > conceptually as the GNU asprintf(), but the interface is different (that >> > func

Re: [PATCH 1/2] strbuf: add xstrdup_fmt helper

2014-06-19 Thread Jeff King
On Wed, Jun 18, 2014 at 03:32:08PM -0700, Junio C Hamano wrote: > > str = xstrdup_fmt(fmt, some, args); > > --- > > I'm open to suggestions on the name. This really is the same thing > > conceptually as the GNU asprintf(), but the interface is different (that > > function takes a pointer-to-poin

Re: [PATCH 1/2] strbuf: add xstrdup_fmt helper

2014-06-18 Thread Junio C Hamano
Jeff King writes: > You can use a strbuf to build up a string from parts, and > then detach it. In the general case, you might use multiple > strbuf_add* functions to do the building. However, in many > cases, a single strbuf_addf is sufficient, and we end up > with: > > struct strbuf buf = STR

[PATCH 1/2] strbuf: add xstrdup_fmt helper

2014-06-18 Thread Jeff King
You can use a strbuf to build up a string from parts, and then detach it. In the general case, you might use multiple strbuf_add* functions to do the building. However, in many cases, a single strbuf_addf is sufficient, and we end up with: struct strbuf buf = STRBUF_INIT; ... strbuf_addf(&bu