summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/select/hash.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/select/hash.c b/src/select/hash.c
index 32034e0..71b655b 100644
--- a/src/select/hash.c
+++ b/src/select/hash.c
@@ -44,7 +44,6 @@ struct css_selector_hash {
static hash_entry empty_slot;
-static inline uint32_t _hash_name(const lwc_string *name);
static inline lwc_string *_class_name(const css_selector *selector);
static inline lwc_string *_id_name(const css_selector *selector);
static css_error _insert_into_chain(css_selector_hash *ctx, hash_entry *head,
@@ -70,6 +69,14 @@ static css_error _iterate_universal(
const css_selector ***next);
+
+
+/* Get case insensitive hash value for a name.
+ * All element/class/id names are known to have their insensitive ptr set. */
+#define _hash_name(name) \
+ lwc_string_hash_value(name->insensitive)
+
+
/* No bytecode if rule body is empty or wholly invalid --
* Only interested in rules with bytecode */
#define RULE_HAS_BYTECODE(r) \
@@ -634,28 +641,6 @@ css_error css__selector_hash_size(css_selector_hash *hash, size_t *size)
******************************************************************************/
/**
- * Name hash function -- case-insensitive FNV.
- *
- * \param name Name to hash
- * \return hash value
- */
-uint32_t _hash_name(const lwc_string *name)
-{
- uint32_t z = 0x811c9dc5;
- const char *data = lwc_string_data(name);
- const char *end = data + lwc_string_length(name);
-
- while (data != end) {
- const char c = *data++;
-
- z *= 0x01000193;
- z ^= c & ~0x20;
- }
-
- return z;
-}
-
-/**
* Retrieve the first class name in a selector, or NULL if none
*
* \param selector Selector to consider