Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislavs Sokurenko <vladislavs.sokurenko@zabbix.com>2022-11-04 14:48:52 +0300
committerVladislavs Sokurenko <vladislavs.sokurenko@zabbix.com>2022-11-04 14:48:52 +0300
commit39474703534840e2ef88901a9ee70dd3399371e8 (patch)
treef50394ec8ab08e2bc895b2d61dfa311d7b7862cc
parent4c11f0afe36b028d9ff57398f815cce360074b2e (diff)
........S. [ZBX-21825] avoid empty error and units strdup
-rw-r--r--src/libs/zbxdbcache/dbcache.c6
-rw-r--r--src/libs/zbxdbcache/dbconfig.c9
2 files changed, 3 insertions, 12 deletions
diff --git a/src/libs/zbxdbcache/dbcache.c b/src/libs/zbxdbcache/dbcache.c
index 0ad704abbee..bab246b2db6 100644
--- a/src/libs/zbxdbcache/dbcache.c
+++ b/src/libs/zbxdbcache/dbcache.c
@@ -1680,7 +1680,7 @@ static void DCinventory_value_add(zbx_vector_ptr_t *inventory_values, const DC_I
return;
}
- zbx_format_value(value, sizeof(value), item->valuemapid, item->units, h->value_type);
+ zbx_format_value(value, sizeof(value), item->valuemapid, ZBX_NULL2EMPTY_STR(item->units), h->value_type);
inventory_value = (zbx_inventory_value_t *)zbx_malloc(NULL, sizeof(zbx_inventory_value_t));
@@ -1969,7 +1969,7 @@ static zbx_item_diff_t *calculate_item_update(DC_ITEM *item, const ZBX_DC_HISTOR
zbx_add_event(EVENT_SOURCE_INTERNAL, EVENT_OBJECT_ITEM, item->itemid, &h->ts, h->state, NULL,
NULL, NULL, 0, 0, NULL, 0, NULL, 0, NULL, h->value.err);
- if (0 != strcmp(item->error, h->value.err))
+ if (0 != strcmp(ZBX_NULL2EMPTY_STR(item->error), h->value.err))
item_error = h->value.err;
}
else
@@ -1985,7 +1985,7 @@ static zbx_item_diff_t *calculate_item_update(DC_ITEM *item, const ZBX_DC_HISTOR
item_error = "";
}
}
- else if (ITEM_STATE_NOTSUPPORTED == h->state && 0 != strcmp(item->error, h->value.err))
+ else if (ITEM_STATE_NOTSUPPORTED == h->state && 0 != strcmp(ZBX_NULL2EMPTY_STR(item->error), h->value.err))
{
zabbix_log(LOG_LEVEL_WARNING, "error reason for \"%s:%s\" changed: %s", item->host.host,
item->key_orig, h->value.err);
diff --git a/src/libs/zbxdbcache/dbconfig.c b/src/libs/zbxdbcache/dbconfig.c
index 1afe3483f10..60f8f42603f 100644
--- a/src/libs/zbxdbcache/dbconfig.c
+++ b/src/libs/zbxdbcache/dbconfig.c
@@ -7264,15 +7264,6 @@ void DCconfig_get_items_by_itemids_partial(DC_ITEM *items, const zbx_uint64_t *i
continue;
items[i].itemid = itemids[i];
-
- if (NULL == items[i].error)
- items[i].error = zbx_strdup(NULL, "");
-
- if (ITEM_VALUE_TYPE_FLOAT == items[i].value_type || ITEM_VALUE_TYPE_UINT64 == items[i].value_type)
- {
- if (NULL == items[i].units)
- items[i].units = zbx_strdup(NULL, "");
- }
}
}