On 1 December 2010 01:07, Magnus Holmgren <magnus...@gmail.com> wrote:
> On Tue, Nov 30, 2010 at 14:12,  <mai...@svn.rockbox.org> wrote:
>> Date: 2010-11-30 14:12:27 +0100 (Tue, 30 Nov 2010)
>> New Revision: 28714
>>
>> Log Message:
>> Very small code shuffle to maybe make parseing %if() a smidgen faster
>
> <...>
>
>> -    if (!strcmp(op, "="))
>> +    if (!strncmp(op, "=", 1))
>
> If anything, it actually makes it slower. strcmp aborts as soon as
> either string ends. strncmp does that too, but it also need to check
> the count (in the implementation Rockbox uses, it is checked two times
> per char).
>
> :)
>
> --
>   Magnus
>

strncmp was also used because otherwsie it was actually broken. I'm
pretty sure the parser does not strip trailing spaces, so %if(foo, = ,
bar) would get rejected. The mentioned speedup was more hopefully from
it not checking every case once one was found.

Reply via email to