diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-05-11 22:06:09 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-05-11 22:06:09 +0100 |
commit | ca1b2e4c3983f94f25fa00ecfac78431e6ccd155 (patch) | |
tree | 9c07d3e731088399b7d0c0590809fabcd9d4ec5b /src/libserver/symcache/symcache_c.cxx | |
parent | a320d3f098da3e2a8021422f2f848d0d0af89d49 (diff) | |
download | rspamd-ca1b2e4c3983f94f25fa00ecfac78431e6ccd155.tar.gz rspamd-ca1b2e4c3983f94f25fa00ecfac78431e6ccd155.zip |
[Fix] Distinguish dynamic and static items
Diffstat (limited to 'src/libserver/symcache/symcache_c.cxx')
-rw-r--r-- | src/libserver/symcache/symcache_c.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/libserver/symcache/symcache_c.cxx b/src/libserver/symcache/symcache_c.cxx index f67078b62..fafc89d19 100644 --- a/src/libserver/symcache/symcache_c.cxx +++ b/src/libserver/symcache/symcache_c.cxx @@ -251,6 +251,39 @@ rspamd_symcache_item_flags(struct rspamd_symcache_item *item) return real_item->get_flags(); } + +const gchar* +rspamd_symcache_dyn_item_name (struct rspamd_task *task, + struct rspamd_symcache_dynamic_item *dyn_item) +{ + auto *cache_runtime = C_API_SYMCACHE_RUNTIME(task->symcache_runtime); + auto *real_dyn_item = C_API_SYMCACHE_DYN_ITEM(dyn_item); + + if (cache_runtime == nullptr || real_dyn_item == nullptr) { + return nullptr; + } + + auto static_item = cache_runtime->get_item_by_dynamic_item(real_dyn_item); + + return static_item->get_name().c_str(); +} + +gint +rspamd_symcache_item_flags(struct rspamd_task *task, + struct rspamd_symcache_dynamic_item *dyn_item) +{ + auto *cache_runtime = C_API_SYMCACHE_RUNTIME(task->symcache_runtime); + auto *real_dyn_item = C_API_SYMCACHE_DYN_ITEM(dyn_item); + + if (cache_runtime == nullptr || real_dyn_item == nullptr) { + return 0; + } + + auto static_item = cache_runtime->get_item_by_dynamic_item(real_dyn_item); + + return static_item->get_flags(); +} + guint rspamd_symcache_get_symbol_flags(struct rspamd_symcache *cache, const gchar *symbol) |