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.
diff --git a/src/fcint.h b/src/fcint.h
index 88e0701..08a0cd6 100644
--- a/src/fcint.h
+++ b/src/fcint.h
@@ -1328,6 +1328,9 @@
FcPrivate FcChar32
FcStrHashIgnoreCase (const FcChar8 *s);
+FcPrivate FcChar32
+FcStrHashIgnoreBlanksAndCase (const FcChar8 *s);
+
FcPrivate FcChar8 *
FcStrCanonFilename (const FcChar8 *s);
diff --git a/src/fcstr.c b/src/fcstr.c
index 39ecbbb..dc9940a 100644
--- a/src/fcstr.c
+++ b/src/fcstr.c
@@ -320,6 +320,19 @@
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?
*/