commit dafba2a: [Minor] Fix options insertion
Vsevolod Stakhov
vsevolod at highsecure.ru
Tue Dec 17 19:07:06 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-12-17 19:04:47 +0000
URL: https://github.com/rspamd/rspamd/commit/dafba2ac60f4bdc99b6f12a858f976133599d686 (HEAD -> master)
[Minor] Fix options insertion
---
src/libmime/scan_result.c | 29 ++++-------------------------
1 file changed, 4 insertions(+), 25 deletions(-)
diff --git a/src/libmime/scan_result.c b/src/libmime/scan_result.c
index 5ded3ac57..7a8451f9c 100644
--- a/src/libmime/scan_result.c
+++ b/src/libmime/scan_result.c
@@ -290,19 +290,9 @@ insert_metric_result (struct rspamd_task *task,
single = TRUE;
}
- /* Now check for the duplicate options */
- if (opt && s->options) {
- k = kh_get (rspamd_options_hash, s->options, opt);
+ s->nshots ++;
- if (k == kh_end (s->options)) {
- rspamd_task_add_result_option (task, s, opt);
- }
- else {
- s->nshots ++;
- }
- }
- else {
- s->nshots ++;
+ if (opt) {
rspamd_task_add_result_option (task, s, opt);
}
@@ -573,19 +563,8 @@ rspamd_task_add_result_option (struct rspamd_task *task,
}
}
else {
- opt = rspamd_mempool_alloc0 (task->task_pool, sizeof (*opt));
-
- if (opt_cpy == NULL) {
- opt_cpy = rspamd_mempool_strdup (task->task_pool, val);
- }
-
- k = kh_put (rspamd_options_hash, s->options, opt_cpy, &r);
-
- kh_value (s->options, k) = opt;
- opt->option = opt_cpy;
- DL_APPEND (s->opts_head, opt);
-
- ret = TRUE;
+ /* Skip addition */
+ ret = FALSE;
}
if (ret && s->opts_len >= 0) {
More information about the Commits
mailing list