[PATCH] Fix strv_addn(), add strv_split()
Volker Lendecke
Volker.Lendecke at SerNet.DE
Mon Feb 29 09:41:48 UTC 2016
On Mon, Feb 29, 2016 at 08:14:02PM +1100, Martin Schwenke wrote:
> On Mon, 29 Feb 2016 15:32:49 +1100, Martin Schwenke <martin at meltin.net>
> wrote:
>
> > 2 patches attached:
> >
> > 1. Fix strv_addn()
> >
> > Well, this is embarrassing! I added strv_add() last week but it
> > doesn't do what it was meant to and actually produces an invalid
> > strv. :-(
> >
> > This fixes it and adds some tests for it.
> >
> > Given that the patch goes close to a revert, I'm happy with the
> > alternative of reverting and adding this anew... but it seems like
> > more hassle.
> >
> > 2. Add strv_split() in new file strv_util.[hc] + tests
> >
> > I mentioned this to Volker and he wants to keep strv.[hc] small, so
> > suggested that a layer on top could go in an extra file, so here it
> > is.
> >
> > Clearly (2) depends on (1), since it uses strv_addn().
>
> Volker sent me an untested but better alternative implementation of
> strv_addn(). I keep forgetting the magic where you can use a
> parameter in the size of a local array declaration... even though
> Amitay mentioned that magic today. :-)
>
> So, attached are 4 patches:
>
> 1. Revert original add of strv_addn()
>
> 2. Add strv_addn()
>
> I've made Volker the author and added his sign-off and my review.
> Hopefully this isn't too cheeky. ;-)
>
> 3. Add strv_addn() tests
Pushed those three.
> 4. Add strv_split() + tests
Nit-picking a bit: Do we need to check for s==NULL in every while
iteration?
Thanks :-)
Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
More information about the samba-technical
mailing list