summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2003-04-30 20:55:27 +0000
committerOwen Taylor <otaylor@src.gnome.org>2003-04-30 20:55:27 +0000
commitb8f461e6261c85b2b1180e5c9d50a4fc854e2bf1 (patch)
tree6f2978a40c36927e49424f62b5d16fca234168bb
parent36270cf8e27b21c5581859eb99687ca81df2c57e (diff)
downloadpango-b8f461e6261c85b2b1180e5c9d50a4fc854e2bf1.tar.gz
Hash case insensitively (#106942, Morten Welinder)
Wed Apr 30 16:46:52 2003 Owen Taylor <otaylor@redhat.com> * pango/fonts.c (pango_font_description_hash): Hash case insensitively (#106942, Morten Welinder)
-rw-r--r--ChangeLog5
-rw-r--r--ChangeLog.pre-1-105
-rw-r--r--ChangeLog.pre-1-45
-rw-r--r--ChangeLog.pre-1-65
-rw-r--r--ChangeLog.pre-1-85
-rw-r--r--pango/fonts.c20
6 files changed, 44 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ea07134d..9e6f4889 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Apr 30 16:46:52 2003 Owen Taylor <otaylor@redhat.com>
+
+ * pango/fonts.c (pango_font_description_hash): Hash
+ case insensitively (#106942, Morten Welinder)
+
Tue Apr 29 18:02:31 2003 Owen Taylor <otaylor@redhat.com>
* configure.in: Add the fonconfig cflags/libs to
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index ea07134d..9e6f4889 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,8 @@
+Wed Apr 30 16:46:52 2003 Owen Taylor <otaylor@redhat.com>
+
+ * pango/fonts.c (pango_font_description_hash): Hash
+ case insensitively (#106942, Morten Welinder)
+
Tue Apr 29 18:02:31 2003 Owen Taylor <otaylor@redhat.com>
* configure.in: Add the fonconfig cflags/libs to
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index ea07134d..9e6f4889 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,8 @@
+Wed Apr 30 16:46:52 2003 Owen Taylor <otaylor@redhat.com>
+
+ * pango/fonts.c (pango_font_description_hash): Hash
+ case insensitively (#106942, Morten Welinder)
+
Tue Apr 29 18:02:31 2003 Owen Taylor <otaylor@redhat.com>
* configure.in: Add the fonconfig cflags/libs to
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index ea07134d..9e6f4889 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,8 @@
+Wed Apr 30 16:46:52 2003 Owen Taylor <otaylor@redhat.com>
+
+ * pango/fonts.c (pango_font_description_hash): Hash
+ case insensitively (#106942, Morten Welinder)
+
Tue Apr 29 18:02:31 2003 Owen Taylor <otaylor@redhat.com>
* configure.in: Add the fonconfig cflags/libs to
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index ea07134d..9e6f4889 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,8 @@
+Wed Apr 30 16:46:52 2003 Owen Taylor <otaylor@redhat.com>
+
+ * pango/fonts.c (pango_font_description_hash): Hash
+ case insensitively (#106942, Morten Welinder)
+
Tue Apr 29 18:02:31 2003 Owen Taylor <otaylor@redhat.com>
* configure.in: Add the fonconfig cflags/libs to
diff --git a/pango/fonts.c b/pango/fonts.c
index 4e67e17c..89e65573 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -618,6 +618,24 @@ pango_font_description_equal (const PangoFontDescription *desc1,
(desc1->family_name && desc2->family_name && g_ascii_strcasecmp (desc1->family_name, desc2->family_name) == 0)));
}
+#define TOLOWER(c) \
+ (((c) >= 'A' && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
+
+static guint
+case_insensitive_hash (const char *key)
+{
+ const char *p = key;
+ guint h = TOLOWER (*p);
+
+ if (h)
+ {
+ for (p += 1; *p != '\0'; p++)
+ h = (h << 5) - h + TOLOWER (*p);
+ }
+
+ return h;
+}
+
/**
* pango_font_description_hash:
* @desc: a #PangoFontDescription
@@ -635,7 +653,7 @@ pango_font_description_hash (const PangoFontDescription *desc)
hash = desc->mask;
if (desc->mask & PANGO_FONT_MASK_FAMILY)
- hash = g_str_hash (desc->family_name);
+ hash = case_insensitive_hash (desc->family_name);
if (desc->mask & PANGO_FONT_MASK_SIZE)
hash ^= desc->size;
if (desc->mask & PANGO_FONT_MASK_STYLE)