[PATCH] Fix strv_addn(), add strv_split()

Martin Schwenke martin at meltin.net
Mon Feb 29 09:14:02 UTC 2016


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

4. Add strv_split() + tests

Please review and maybe push...

peace & happiness,
martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: samba.patch
Type: text/x-patch
Size: 15750 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160229/6db954f7/samba.bin>


More information about the samba-technical mailing list