{
auto *real_cache = C_API_SYMCACHE(cache);
+ /* Legacy stuff */
+ if (name == nullptr) {
+ name = "";
+ }
+
if (parent == -1) {
return real_cache->add_symbol_with_callback(name, priority, func, user_data, type);
}
return TRUE;
}
-gint rspamd_symcache_find_symbol(struct rspamd_symcache *cache,
+gint
+rspamd_symcache_find_symbol(struct rspamd_symcache *cache,
const gchar *name)
{
auto *real_cache = C_API_SYMCACHE(cache);
+ /* Legacy stuff but used */
+ if (name == nullptr) {
+ return -1;
+ }
+
auto sym_maybe = real_cache->get_item_by_name(name, false);
if (sym_maybe != nullptr) {
return -1;
}
-gboolean rspamd_symcache_stat_symbol(struct rspamd_symcache *cache,
+gboolean
+rspamd_symcache_stat_symbol(struct rspamd_symcache *cache,
const gchar *name,
gdouble *frequency,
gdouble *freq_stddev,
std::string static_string_name;
if (name.empty()) {
- static_string_name = fmt::format("AUTO_{}", (void *) func);
+ static_string_name = fmt::format("AUTO_{}_{}", (void *)func, user_data);
+ msg_warn_cache("trying to add an empty symbol name, convert it to %s",
+ static_string_name.c_str());
}
else {
static_string_name = name;