diff options
author | Artjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com> | 2021-09-08 14:55:32 +0300 |
---|---|---|
committer | Artjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com> | 2021-09-08 14:55:32 +0300 |
commit | 1439caf04858366bf0104a532554de5fb4a5003c (patch) | |
tree | 47e56c917c3986310e571d195ec88b8f77089913 /src/libs/zbxaudit/audit_host.c | |
parent | 8445b02b394b9fd8447f88f286f990062c74f78e (diff) |
........S. [ZBXNEXT-6855] consolidated zbx_audit_entry variables initialization in dedicated function
Diffstat (limited to 'src/libs/zbxaudit/audit_host.c')
-rw-r--r-- | src/libs/zbxaudit/audit_host.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/libs/zbxaudit/audit_host.c b/src/libs/zbxaudit/audit_host.c index e124a737e6c..5184e55a53f 100644 --- a/src/libs/zbxaudit/audit_host.c +++ b/src/libs/zbxaudit/audit_host.c @@ -196,12 +196,8 @@ void zbx_audit_##funcname##_create_entry(int audit_action, zbx_uint64_t hostid, { \ zbx_audit_entry_t *local_audit_host_entry_insert; \ \ - local_audit_host_entry_insert = (zbx_audit_entry_t*)zbx_malloc(NULL, sizeof(zbx_audit_entry_t));\ - local_audit_host_entry_insert->id = hostid; \ - local_audit_host_entry_insert->name = zbx_strdup(NULL, name); \ - local_audit_host_entry_insert->audit_action = audit_action; \ - local_audit_host_entry_insert->resource_type = audit_resource_flag; \ - zbx_json_init(&(local_audit_host_entry_insert->details_json), ZBX_JSON_STAT_BUF_LEN); \ + local_audit_host_entry_insert = zbx_audit_entry_init(hostid, name, audit_action, \ + audit_resource_flag); \ zbx_hashset_insert(zbx_get_audit_hashset(), &local_audit_host_entry_insert, \ sizeof(local_audit_host_entry_insert)); \ \ @@ -814,12 +810,8 @@ void zbx_audit_host_group_create_entry(int audit_action, zbx_uint64_t groupid, c { zbx_audit_entry_t *local_audit_group_entry_insert; - local_audit_group_entry_insert = (zbx_audit_entry_t*)zbx_malloc(NULL, sizeof(zbx_audit_entry_t)); - local_audit_group_entry_insert->id = groupid; - local_audit_group_entry_insert->name = zbx_strdup(NULL, name); - local_audit_group_entry_insert->audit_action = audit_action; - local_audit_group_entry_insert->resource_type = AUDIT_RESOURCE_HOST_GROUP; - zbx_json_init(&(local_audit_group_entry_insert->details_json), ZBX_JSON_STAT_BUF_LEN); + local_audit_group_entry_insert = zbx_audit_entry_init(groupid, name, audit_action, + AUDIT_RESOURCE_HOST_GROUP); zbx_hashset_insert(zbx_get_audit_hashset(), &local_audit_group_entry_insert, sizeof(local_audit_group_entry_insert)); } |