Re: [PATCHv3] attr: convert to new threadsafe API

2016-10-18 Thread Junio C Hamano
Stefan Beller writes: > I am not sure if I see the upside on wrapping a single value except for > its future proofness, I do not see anything other than future-proofing, either. If we need to touch all the code that uses the attributes to update the API, I'd prefer to avoid having to do that ag

Re: [PATCHv3] attr: convert to new threadsafe API

2016-10-18 Thread Stefan Beller
On Tue, Oct 18, 2016 at 5:06 PM, Junio C Hamano wrote: > On Tue, Oct 18, 2016 at 4:52 PM, Stefan Beller wrote: >> >> > >> > By the way, I do see a merit on the "check" side (tl;dr: but I do >> > not think "result" needs it, hence I do not see the need for the >> > "ugly" variants). >> >> So we'd

Re: [PATCHv3] attr: convert to new threadsafe API

2016-10-18 Thread Junio C Hamano
On Tue, Oct 18, 2016 at 4:52 PM, Stefan Beller wrote: > > > > > By the way, I do see a merit on the "check" side (tl;dr: but I do > > not think "result" needs it, hence I do not see the need for the > > "ugly" variants). > > So we'd rather go with const char **result instead of our own new struct

Re: [PATCHv3] attr: convert to new threadsafe API

2016-10-18 Thread Stefan Beller
On Fri, Oct 14, 2016 at 8:37 AM, Junio C Hamano wrote: > Junio C Hamano writes: > >> *1* Would we need a wrapping struct around the array of results? > > By the way, I do see a merit on the "check" side (tl;dr: but I do > not think "result" needs it, hence I do not see the need for the > "ugly" v

Re: [PATCHv3] attr: convert to new threadsafe API

2016-10-14 Thread Junio C Hamano
Junio C Hamano writes: > *1* Would we need a wrapping struct around the array of results? By the way, I do see a merit on the "check" side (tl;dr: but I do not think "result" needs it, hence I do not see the need for the "ugly" variants). Take "archive" for example. For each path, it wants to

Re: [PATCHv3] attr: convert to new threadsafe API

2016-10-13 Thread Stefan Beller
> On Wed, Oct 12, 2016 at 4:33 PM, Junio C Hamano wrote: > so I am hoping that we won't have to do this uglier variant ---8<--- attr.h: ... struct git_attr_result { int check_nr; /* Whether is was statically allocated and cannot be resized. */ int static_alloc; const char *value[F

Re: [PATCHv3] attr: convert to new threadsafe API

2016-10-13 Thread Stefan Beller
On Wed, Oct 12, 2016 at 4:33 PM, Junio C Hamano wrote: > Stefan Beller writes: > >> @@ -89,15 +114,20 @@ static void setup_check(void) >> >> >> const char *path; >> + struct git_attr_result *result; >> >> setup_check(); >> - git_check_attr(path, check); >> +

Re: [PATCHv3] attr: convert to new threadsafe API

2016-10-12 Thread Junio C Hamano
Stefan Beller writes: > @@ -89,15 +114,20 @@ static void setup_check(void) > > > const char *path; > + struct git_attr_result *result; > > setup_check(); > - git_check_attr(path, check); > + result = git_check_attr(path, check); This looks stale by a few

[PATCHv3] attr: convert to new threadsafe API

2016-10-12 Thread Stefan Beller
This revamps the API of the attr subsystem to be thread safe. Before we had the question and its results in one struct type. The typical usage of the API was static struct git_attr_check *check; if (!check) check = git_attr_check_initl("text", NULL); git_check_attr(path, chec