summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <Michael Drake tlsa@netsurf-browser.org>2019-08-01 09:28:27 +0100
committerMichael Drake <Michael Drake tlsa@netsurf-browser.org>2019-08-01 09:28:27 +0100
commit1fb312312cdd01b3cf59950eacc7762f01c41a50 (patch)
treeb9df4cf508270f5577bc6b250cc065dacef97f55
parentba1d79992750773e3decdf485b40b283d81837a9 (diff)
downloadlibcss-master.tar.gz
libcss-master.tar.bz2
Select hash: Simplify insertion at start of non-empty list.HEADmaster
This might help Coverity understand what's going on.
-rw-r--r--src/select/hash.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/select/hash.c b/src/select/hash.c
index 92457d8..4b11702 100644
--- a/src/select/hash.c
+++ b/src/select/hash.c
@@ -815,24 +815,23 @@ css_error _insert_into_chain(css_selector_hash *ctx, hash_entry *head,
search = search->next;
} while (search != NULL);
- entry->sel = selector;
- _chain_bloom_generate(selector, entry->sel_chain_bloom);
-
-#ifdef PRINT_CHAIN_BLOOM_DETAILS
- print_chain_bloom_details(entry->sel_chain_bloom);
-#endif
-
if (prev == NULL) {
- hash_entry temp;
- entry->next = entry;
- temp = *entry;
*entry = *head;
- *head = temp;
+ head->next = entry;
+
+ entry = head;
} else {
entry->next = prev->next;
prev->next = entry;
}
+ entry->sel = selector;
+ _chain_bloom_generate(selector, entry->sel_chain_bloom);
+
+#ifdef PRINT_CHAIN_BLOOM_DETAILS
+ print_chain_bloom_details(entry->sel_chain_bloom);
+#endif
+
ctx->hash_size += sizeof(hash_entry);
}