diff options
author | Michael Drake <Michael Drake tlsa@netsurf-browser.org> | 2019-08-01 09:28:27 +0100 |
---|---|---|
committer | Michael Drake <Michael Drake tlsa@netsurf-browser.org> | 2019-08-01 09:28:27 +0100 |
commit | 1fb312312cdd01b3cf59950eacc7762f01c41a50 (patch) | |
tree | b9df4cf508270f5577bc6b250cc065dacef97f55 | |
parent | ba1d79992750773e3decdf485b40b283d81837a9 (diff) | |
download | libcss-1fb312312cdd01b3cf59950eacc7762f01c41a50.tar.gz libcss-1fb312312cdd01b3cf59950eacc7762f01c41a50.tar.bz2 |
Select hash: Simplify insertion at start of non-empty list.
This might help Coverity understand what's going on.
-rw-r--r-- | src/select/hash.c | 21 |
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); } |