[libav-devel] [PATCH 1/2] Replace all usage of strcasecmp/strncasecmp

Luca Barbato lu_zero at gentoo.org
Sat Nov 5 00:10:37 CET 2011


On 11/4/11 3:46 PM, Martin Storsjö wrote:
> On Fri, 4 Nov 2011, Luca Barbato wrote:
>
>> On 11/4/11 11:16 AM, Måns Rullgård wrote:
>>> Luca Barbato<lu_zero at gentoo.org> writes:
>>>
>>>> On 11/4/11 9:45 AM, Kostya Shishkov wrote:
>>>>> On Fri, Nov 04, 2011 at 04:42:11PM +0000, Måns Rullgård wrote:
>>>>>> Luca Barbato<lu_zero at gentoo.org> writes:
>>>>>>
>>>>>>> On 11/4/11 9:28 AM, Måns Rullgård wrote:
>>>>>>>> Write it in a non-ugly way of course.
>>>>>>>
>>>>>>> Let me expand:
>>>>>>>
>>>>>>> - the strcasecmp/strncasecmp itself isn't much different than the
>>>>>>> usual libc implementation, the toupper can enjoy a better
>>>>>>> implementation (to be noted that in all libc I had a look into
>>>>>>> strcase
>>>>>>> uses tolower).
>>>>>>
>>>>>> Yes, that macro is what I was talking about.
>>>>>
>>>>> What about
>>>>>
>>>>> #define TOUPPER(c) \
>>>>> if (c>= 'a'&& c<= 'z') \
>>>>> c ^= 0x20;
>>>>
>>>> Looks nicer.
>>>
>>> I'd make it a bit more function-like or even an inline function.
>>>
>>
>> Do we have other uses for it (seems we are using toupper somewhere as
>> well?
>
> Yes, I think it might be useful in most (all?) other places, too.
>
> If it's kept as a static inline function, I don't like av_ as prefix for
> it, since it tells me that it is an external function. Not sure what
> would be better though (and something is necessary), since ff_ has a
> certain meaning, too. ascii_toupper() perhaps? OTOH, if it's made a
> public function, av_ is the right prefix of course.
>

I guess we could stick it in the public header as static inline and be 
done with that.

lu


More information about the libav-devel mailing list