item->frequency = ucl_object_toint (elt);
}
- if (item->type == SYMBOL_TYPE_VIRTUAL && item->parent != -1) {
+ if ((item->type & SYMBOL_TYPE_VIRTUAL) && item->parent != -1) {
g_assert (item->parent < (gint)cache->items_by_id->len);
parent = g_ptr_array_index (cache->items_by_id, item->parent);
name);
}
- if (name != NULL) {
+ if (name != NULL && type != SYMBOL_TYPE_CALLBACK) {
if (g_hash_table_lookup (cache->items_by_symbol, name) != NULL) {
msg_err ("skip duplicate symbol registration for %s", name);
return -1;
rspamd_mempool_add_destructor (cache->static_pool,
rspamd_ptr_array_free_hard, item->rdeps);
- if (name != NULL) {
+ if (name != NULL && type != SYMBOL_TYPE_CALLBACK) {
g_hash_table_insert (cache->items_by_symbol, item->symbol, item);
}
/* Check whether this item is skipped */
skipped = !ghost;
- if (item->type == SYMBOL_TYPE_NORMAL && cache->cfg &&
+ if ((item->type & SYMBOL_TYPE_NORMAL) && cache->cfg &&
g_hash_table_lookup (cache->cfg->metrics_symbols, item->symbol) == NULL) {
cur = g_list_first (cache->cfg->metrics_list);
while (cur) {
}
if (skipped) {
- item->type = SYMBOL_TYPE_SKIPPED;
+ item->type |= SYMBOL_TYPE_SKIPPED;
msg_warn ("symbol %s is not registered in any metric, so skip its check",
item->symbol);
}
item->priority ++;
}
- if (item->type == SYMBOL_TYPE_VIRTUAL && item->parent != -1) {
+ if ((item->type & SYMBOL_TYPE_VIRTUAL) && item->parent != -1) {
g_assert (item->parent < (gint)cache->items_by_id->len);
parent = g_ptr_array_index (cache->items_by_id, item->parent);
double t1, t2;
guint64 diff;
- if (item->type == SYMBOL_TYPE_NORMAL || item->type == SYMBOL_TYPE_CALLBACK) {
+ if (item->type & (SYMBOL_TYPE_NORMAL|SYMBOL_TYPE_CALLBACK)) {
g_assert (item->func != NULL);
/* Check has been started */
top = cbd->top;
- if (item->type != SYMBOL_TYPE_CALLBACK) {
+ if (!(item->type & SYMBOL_TYPE_CALLBACK)) {
obj = ucl_object_typed_new (UCL_OBJECT);
ucl_object_insert_key (obj, ucl_object_fromstring (item->symbol),
"symbol", 0, false);
- if (item->type == SYMBOL_TYPE_VIRTUAL && item->parent != -1) {
+ if ((item->type & SYMBOL_TYPE_VIRTUAL) && item->parent != -1) {
g_assert (item->parent < (gint)cbd->cache->items_by_id->len);
parent = g_ptr_array_index (cbd->cache->items_by_id,
item->parent);
for (i = 0; i < cache->items_by_order->len; i ++) {
item = g_ptr_array_index (cache->items_by_order, i);
- if (item->type == SYMBOL_TYPE_CALLBACK ||
- item->type == SYMBOL_TYPE_NORMAL) {
+ if (item->type & (SYMBOL_TYPE_CALLBACK|SYMBOL_TYPE_NORMAL)) {
if (item->cd->number > 0) {
item->avg_counter += item->cd->number + 1;
item->avg_time = item->avg_time +