Use __builtin_expect in a few places
utf8 is extremely rare in the strings we see in font configuration, so this seems to be a good case for __builtin_expect.
This commit is contained in:
parent
13015a0a6e
commit
148ebf98ed
12
src/fcstr.c
12
src/fcstr.c
|
@ -164,7 +164,7 @@ FcStrCaseWalkerNextNonDelim (FcCaseWalker *w, const char *delims)
|
||||||
{
|
{
|
||||||
FcChar8 r;
|
FcChar8 r;
|
||||||
|
|
||||||
if (w->read)
|
if (__builtin_expect (w->read != NULL, 0))
|
||||||
{
|
{
|
||||||
if ((r = *w->read++))
|
if ((r = *w->read++))
|
||||||
return r;
|
return r;
|
||||||
|
@ -175,7 +175,7 @@ FcStrCaseWalkerNextNonDelim (FcCaseWalker *w, const char *delims)
|
||||||
r = *w->src++;
|
r = *w->src++;
|
||||||
} while (r != 0 && delims && strchr (delims, r));
|
} while (r != 0 && delims && strchr (delims, r));
|
||||||
|
|
||||||
if ((r & 0xc0) == 0xc0)
|
if (__builtin_expect ((r & 0xc0) == 0xc0, 0))
|
||||||
return FcStrCaseWalkerLong (w, r);
|
return FcStrCaseWalkerLong (w, r);
|
||||||
if ('A' <= r && r <= 'Z')
|
if ('A' <= r && r <= 'Z')
|
||||||
r = r - 'A' + 'a';
|
r = r - 'A' + 'a';
|
||||||
|
@ -187,7 +187,7 @@ FcStrCaseWalkerNextNonBlank (FcCaseWalker *w)
|
||||||
{
|
{
|
||||||
FcChar8 r;
|
FcChar8 r;
|
||||||
|
|
||||||
if (w->read)
|
if (__builtin_expect (w->read != NULL, 0))
|
||||||
{
|
{
|
||||||
if ((r = *w->read++))
|
if ((r = *w->read++))
|
||||||
return r;
|
return r;
|
||||||
|
@ -198,7 +198,7 @@ FcStrCaseWalkerNextNonBlank (FcCaseWalker *w)
|
||||||
r = *w->src++;
|
r = *w->src++;
|
||||||
} while (r == ' ');
|
} while (r == ' ');
|
||||||
|
|
||||||
if ((r & 0xc0) == 0xc0)
|
if (__builtin_expect ((r & 0xc0) == 0xc0, 0))
|
||||||
return FcStrCaseWalkerLong (w, r);
|
return FcStrCaseWalkerLong (w, r);
|
||||||
if ('A' <= r && r <= 'Z')
|
if ('A' <= r && r <= 'Z')
|
||||||
r = r - 'A' + 'a';
|
r = r - 'A' + 'a';
|
||||||
|
@ -210,7 +210,7 @@ FcStrCaseWalkerNext (FcCaseWalker *w)
|
||||||
{
|
{
|
||||||
FcChar8 r;
|
FcChar8 r;
|
||||||
|
|
||||||
if (w->read)
|
if (__builtin_expect (w->read != NULL, 0))
|
||||||
{
|
{
|
||||||
if ((r = *w->read++))
|
if ((r = *w->read++))
|
||||||
return r;
|
return r;
|
||||||
|
@ -219,7 +219,7 @@ FcStrCaseWalkerNext (FcCaseWalker *w)
|
||||||
|
|
||||||
r = *w->src++;
|
r = *w->src++;
|
||||||
|
|
||||||
if ((r & 0xc0) == 0xc0)
|
if (__builtin_expect ((r & 0xc0) == 0xc0, 0))
|
||||||
return FcStrCaseWalkerLong (w, r);
|
return FcStrCaseWalkerLong (w, r);
|
||||||
if ('A' <= r && r <= 'Z')
|
if ('A' <= r && r <= 'Z')
|
||||||
r = r - 'A' + 'a';
|
r = r - 'A' + 'a';
|
||||||
|
|
Loading…
Reference in New Issue