Re: [PATCH v8 03/12] Move lower case functions into wrapper.c

2014-03-28 Thread Jeff King
On Fri, Mar 28, 2014 at 10:12:15AM -0700, Junio C Hamano wrote: > By the way, that is "rfc2822"---do we want "rfc822" as its synonym > as well as "rfc", I wonder ;-) Oops, I wrote that as I was literally looking at the code that said rfc2822 and didn't notice. On the other hand, I have never made

Re: [PATCH v8 03/12] Move lower case functions into wrapper.c

2014-03-28 Thread Junio C Hamano
Jeff King writes: > But I also do not overly care. Literally zero people have complained > that "[log]date = RFC822" is not accepted, so it is probably not a big > deal either way. That is most likely because we do not advertise these enum values spelled in random cases in our documentation and

Re: [PATCH v8 03/12] Move lower case functions into wrapper.c

2014-03-28 Thread Christian Couder
From: Jeff King Subject: Re: [PATCH v8 03/12] Move lower case functions into wrapper.c Date: Thu, 27 Mar 2014 18:34:06 -0400 > On Thu, Mar 27, 2014 at 03:16:48PM -0700, Junio C Hamano wrote: > >> > I wasn't looking at the caller (and I haven't). I agree that, if >

Re: [PATCH v8 03/12] Move lower case functions into wrapper.c

2014-03-27 Thread Jeff King
On Thu, Mar 27, 2014 at 03:47:01PM -0700, Junio C Hamano wrote: > Actually, I think it ends up being hostile to the users to accept > random cases without a good reason. If you see two trailer elements > whose where are specified as "after" and "AFTER" in somebody's > configuration file, wouldn't

Re: [PATCH v8 03/12] Move lower case functions into wrapper.c

2014-03-27 Thread Junio C Hamano
Jeff King writes: > All bool config values allow "tRuE". I was expecting somebody will bring it up, but think about it. Bool is a very special case. Even among CS folks, depending on your background, true may be True may be TRUE may be 1. Conflating it with some random enum does not make a go

Re: [PATCH v8 03/12] Move lower case functions into wrapper.c

2014-03-27 Thread Jeff King
On Thu, Mar 27, 2014 at 03:16:48PM -0700, Junio C Hamano wrote: > > I wasn't looking at the caller (and I haven't). I agree that, if > > you have to compare case-insensitive user input against known set of > > tokens, using strcasecmp() would be saner than making a downcased > > copy and the set

Re: [PATCH v8 03/12] Move lower case functions into wrapper.c

2014-03-27 Thread Junio C Hamano
Junio C Hamano writes: > Christian Couder writes: > >> Yeah, but it seems a bit wasteful to allocate memory for a new string, >> then downcase it, then compare it with strcmp() and then free it, >> instead of just using strcasecmp() on the original string. > > I wasn't looking at the caller (and

Re: [PATCH v8 03/12] Move lower case functions into wrapper.c

2014-03-27 Thread Junio C Hamano
Christian Couder writes: > Yeah, but it seems a bit wasteful to allocate memory for a new string, > then downcase it, then compare it with strcmp() and then free it, > instead of just using strcasecmp() on the original string. I wasn't looking at the caller (and I haven't). I agree that, if you

Re: [PATCH v8 03/12] Move lower case functions into wrapper.c

2014-03-27 Thread Christian Couder
From: Junio C Hamano > > Christian Couder writes: > >> diff --git a/wrapper.c b/wrapper.c >> index 0cc5636..c46026a 100644 >> --- a/wrapper.c >> +++ b/wrapper.c >> @@ -455,3 +455,17 @@ struct passwd *xgetpwuid_self(void) >> errno ? strerror(errno) : _("no such user")); >> r

Re: [PATCH v8 03/12] Move lower case functions into wrapper.c

2014-03-26 Thread Junio C Hamano
Christian Couder writes: > diff --git a/wrapper.c b/wrapper.c > index 0cc5636..c46026a 100644 > --- a/wrapper.c > +++ b/wrapper.c > @@ -455,3 +455,17 @@ struct passwd *xgetpwuid_self(void) > errno ? strerror(errno) : _("no such user")); > return pw; > } > + > +void lowerc

[PATCH v8 03/12] Move lower case functions into wrapper.c

2014-03-26 Thread Christian Couder
The lowercase() function from config.c and the xstrdup_tolower() function from daemon.c can benefit from being moved to the same place because this way the latter can use the former. Also let's make them available globally so we can use them from other places like trailer.c. Signed-off-by: Christ