Re: [PATCH v8 03/12] Move lower case functions into wrapper.c
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 27, 2014, 16:42 UTC
- Message-ID
- <xmqq4n2jfva5.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <20140327.084745.2069840957131666658.chriscool@tuxfamily.org>
Christian Couder <chriscool@tuxfamily.org> 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 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 of known tokens. I do not know however you want to compare in a case-insensitive way in your application, though.