[Commit] fontconfig/src fclang.c,1.11,1.11.2.1
Keith Packard
commit at keithp.com
Mon Jun 9 12:25:06 PDT 2003
Committed by: keithp
Update of /local/src/CVS/fontconfig/src
In directory home.keithp.com:/tmp/cvs-serv5748
Modified Files:
Tag: fc-2_2_branch
fclang.c
Log Message:
Apply patch from head for FcLangSetIndex to fix optimized matcher
Index: fclang.c
===================================================================
RCS file: /local/src/CVS/fontconfig/src/fclang.c,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -d -r1.11 -r1.11.2.1
--- fclang.c 17 Apr 2003 17:43:04 -0000 1.11
+++ fclang.c 9 Jun 2003 18:25:04 -0000 1.11.2.1
@@ -262,6 +262,7 @@
int low, high, mid = 0;
int cmp = 0;
FcChar8 firstChar = FcToLower(lang[0]);
+ FcChar8 secondChar = firstChar ? FcToLower(lang[1]) : '\0';
if (firstChar < 'a')
{
@@ -290,22 +291,14 @@
else
{ /* fast path for resolving 2-letter languages (by far the most common) after
* finding the first char (probably already true because of the hash table) */
- FcChar8 secondChar = FcToLower(lang[1]);
- if (fcLangCharSets[mid].lang[1] > secondChar) /* check second chars */
- {
- high = mid - 1;
- continue;
- }
- else if (fcLangCharSets[mid].lang[1] < secondChar)
+ cmp = fcLangCharSets[mid].lang[1] - secondChar;
+ if (cmp == 0 &&
+ (fcLangCharSets[mid].lang[2] != '\0' ||
+ lang[2] != '\0'))
{
- low = mid + 1;
- continue;
+ cmp = FcStrCmpIgnoreCase(fcLangCharSets[mid].lang+2,
+ lang+2);
}
- else if (fcLangCharSets[mid].lang[2] == '\0' && lang[2] == '\0')
- return mid;
-
- else /* identical through the first two charcters, but at least one string didn't end there */
- cmp = FcStrCmpIgnoreCase(fcLangCharSets[mid].lang+2, lang+2);
}
if (cmp == 0)
return mid;
More information about the Commit
mailing list