[Fontconfig] fontconfig: Branch 'master' - 2 commits

Akira TAGOH akira at tagoh.org
Thu Mar 5 18:15:49 PST 2015


Ah, thanks! fixed.

On Fri, Mar 6, 2015 at 7:29 AM, Raimund Steger <rs at mytum.de> wrote:

> On 03/05/15 09:56, Akira TAGOH wrote:
>
>> just committed the change. that should works better now.
>>
>
>
> Yup it's fast again now... but:
>
>    FcBool
>>   FcBlanksIsMember (FcBlanks *b, FcChar32 ucs4)
>>   {
>> -    int        i;
>> +    int lower = 0, higher = b->nblank, middle;
>>
>> -    for (i = 0; i < b->nblank; i++)
>> -       if (b->blanks[i] == ucs4)
>> +    if (b->nblank == 0 ||
>> +       b->blanks[0] > ucs4 ||
>> +       b->blanks[b->nblank - 1] < ucs4)
>> +       return FcFalse;
>> +    while (1)
>> +    {
>> +       middle = (lower + higher) / 2;
>> +       if (b->blanks[middle] == ucs4)
>>             return FcTrue;
>> +       if (middle == lower ||
>> +           middle == higher)
>>
>
>
> wouldn't this need to be:
>
>   if (lower == higher)
>
>
> Rationale:
>
> If lower and higher are 1 apart, one bound will be checked, but not the
> other. For the current list of blanks and my font cache, I observed the
> following with ucs4==0xfe07 (which is /in/ the list):
>
>
> sun2:fontconfig)dbx `which fc-cache`
> [...]
> (dbx) runargs -f
> (dbx) stop at fcblanks.c:93 -if higher-lower==1 && ucs4==0xfe07
> (2) stop at "fcblanks.c":93 -if higher-lower == 1 && ucs4 == 0xfe07
> (dbx) run
> Running: fc-cache -f
> (process id 22766)
> t at 1 (l at 1) stopped in FcBlanksIsMember at line 93 in file "fcblanks.c"
>    93           middle = (lower + higher) / 2;
> (dbx) next
> t at 1 (l at 1) stopped in FcBlanksIsMember at line 94 in file "fcblanks.c"
>    94           if (b->blanks[middle] == ucs4)
> (dbx) print lower,middle,higher,b->blanks[middle],b->blanks[higher],ucs4
> lower = 62
> middle = 62
> higher = 63
> b->blanks[middle] = 65030U
> b->blanks[higher] = 65031U
> ucs4 = 65031U
> (dbx) next
> t at 1 (l at 1) stopped in FcBlanksIsMember at line 97 in file "fcblanks.c"
>    97               middle == higher)
> (dbx) next
> t at 1 (l at 1) stopped in FcBlanksIsMember at line 98 in file "fcblanks.c"
>    98               break;
> (dbx) next
> t at 1 (l at 1) stopped in FcBlanksIsMember at line 105 in file "fcblanks.c"
>   105       return FcFalse;
>
>
>
>
>
>
> --
> Worringer Str 31 Duesseldorf 40211 DE  home: <rs at mytum.de>
> +49-179-2981632 icq 16845346           work: <rs at interface-ag.de>
>



-- 
Akira TAGOH
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/fontconfig/attachments/20150306/8e0d3a42/attachment.html>


More information about the Fontconfig mailing list