Re: [PATCH 03/10] sha1-array: provide oid_array_remove_if

2018-08-09 Thread Junio C Hamano
Jeff King writes: > Even with keeping the order this can be done in a single linear pass. > See filter_string_list() for an example. Heh, I just wasted a few minutes saying the same; I should have pointed him at these two lines ;-)

Re: [PATCH 03/10] sha1-array: provide oid_array_remove_if

2018-08-09 Thread Junio C Hamano
Stefan Beller writes: > Signed-off-by: Stefan Beller > --- > sha1-array.c | 39 +++ > sha1-array.h | 3 +++ > 2 files changed, 42 insertions(+) > > diff --git a/sha1-array.c b/sha1-array.c > index 265941fbf40..10eb08b425e 100644 > --- a/sha1-array.c > +++

Re: [PATCH 03/10] sha1-array: provide oid_array_remove_if

2018-08-09 Thread Jeff King
On Thu, Aug 09, 2018 at 10:25:52AM -0700, Stefan Beller wrote: > On Thu, Aug 9, 2018 at 12:39 AM Martin Ågren wrote: > > > > On 9 August 2018 at 00:17, Stefan Beller wrote: > > > +int oid_array_remove_if(struct oid_array *array, > > > + for_each_oid_fn fn, > > > +

Re: [PATCH 03/10] sha1-array: provide oid_array_remove_if

2018-08-09 Thread Stefan Beller
On Thu, Aug 9, 2018 at 12:39 AM Martin Ågren wrote: > > On 9 August 2018 at 00:17, Stefan Beller wrote: > > +int oid_array_remove_if(struct oid_array *array, > > + for_each_oid_fn fn, > > + void *data) > > +{ > > + int i, j; > > + char

Re: [PATCH 03/10] sha1-array: provide oid_array_remove_if

2018-08-09 Thread Martin Ågren
On 9 August 2018 at 00:17, Stefan Beller wrote: > +int oid_array_remove_if(struct oid_array *array, > + for_each_oid_fn fn, > + void *data) > +{ > + int i, j; > + char *to_remove = xcalloc(array->nr, sizeof(char)); Do you really need this

[PATCH 03/10] sha1-array: provide oid_array_remove_if

2018-08-08 Thread Stefan Beller
Signed-off-by: Stefan Beller --- sha1-array.c | 39 +++ sha1-array.h | 3 +++ 2 files changed, 42 insertions(+) diff --git a/sha1-array.c b/sha1-array.c index 265941fbf40..10eb08b425e 100644 --- a/sha1-array.c +++ b/sha1-array.c @@ -77,3 +77,42 @@ int