summaryrefslogtreecommitdiffstats
path: root/src/libserver/css
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2022-06-24 21:52:17 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2022-06-24 21:52:17 +0100
commit8bb63981133b479dcaf24b9d34d43993c1b732c8 (patch)
treeab409f276251d0e10aa7b88b54f0983803b915f6 /src/libserver/css
parentaec9ff27cb3eee126594904282610d619ff57416 (diff)
downloadrspamd-8bb63981133b479dcaf24b9d34d43993c1b732c8.tar.gz
rspamd-8bb63981133b479dcaf24b9d34d43993c1b732c8.zip
[Minor] Simplify code
Diffstat (limited to 'src/libserver/css')
-rw-r--r--src/libserver/css/css.cxx9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/libserver/css/css.cxx b/src/libserver/css/css.cxx
index 9e26eb42f..895853132 100644
--- a/src/libserver/css/css.cxx
+++ b/src/libserver/css/css.cxx
@@ -78,13 +78,10 @@ css_style_sheet::add_selector_rule(std::unique_ptr<css_selector> &&selector,
}
if (target_hash) {
- auto found_it = target_hash->find(selector);
- if (found_it == target_hash->end()) {
- /* Easy case, new element */
- target_hash->insert({std::move(selector), decls});
- }
- else {
+ auto [found_it, found] = target_hash->try_emplace(std::move(selector), decls);
+
+ if (found) {
/* The problem with merging is actually in how to handle selectors chains
* For example, we have 2 selectors:
* 1. class id tag -> meaning that we first match class, then we ensure that