Add a hash function for families
Add a hash function that behaves like family comparison: ignoring case and blanks. This will be used to replace the list walking for finding family matches with a hash table.
This commit is contained in:
parent
46d818df26
commit
055843631b
|
@ -1328,6 +1328,9 @@ FcStrLastSlash (const FcChar8 *path);
|
||||||
FcPrivate FcChar32
|
FcPrivate FcChar32
|
||||||
FcStrHashIgnoreCase (const FcChar8 *s);
|
FcStrHashIgnoreCase (const FcChar8 *s);
|
||||||
|
|
||||||
|
FcPrivate FcChar32
|
||||||
|
FcStrHashIgnoreBlanksAndCase (const FcChar8 *s);
|
||||||
|
|
||||||
FcPrivate FcChar8 *
|
FcPrivate FcChar8 *
|
||||||
FcStrCanonFilename (const FcChar8 *s);
|
FcStrCanonFilename (const FcChar8 *s);
|
||||||
|
|
||||||
|
|
13
src/fcstr.c
13
src/fcstr.c
|
@ -320,6 +320,19 @@ FcStrHashIgnoreCase (const FcChar8 *s)
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FcChar32
|
||||||
|
FcStrHashIgnoreBlanksAndCase (const FcChar8 *s)
|
||||||
|
{
|
||||||
|
FcChar32 h = 0;
|
||||||
|
FcCaseWalker w;
|
||||||
|
FcChar8 c;
|
||||||
|
|
||||||
|
FcStrCaseWalkerInit (s, &w);
|
||||||
|
while ((c = FcStrCaseWalkerNextNonBlank (&w)))
|
||||||
|
h = ((h << 3) ^ (h >> 3)) ^ c;
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is the head of s1 equal to s2?
|
* Is the head of s1 equal to s2?
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue