diff options
author | Federico Ceratto <federico.ceratto@gmail.com> | 2018-03-27 21:28:21 +0000 |
---|---|---|
committer | Federico Ceratto <federico.ceratto@gmail.com> | 2018-03-27 21:28:21 +0000 |
commit | d4dd00f58a502c9ca4b63e36ce6bc7a9945dc63c (patch) | |
tree | faac99f51f182bb8c0a03e95e393d421ac9ddf42 /src/rrdsetvar.c | |
parent | New upstream version 1.9.0+dfsg (diff) | |
download | netdata-d4dd00f58a502c9ca4b63e36ce6bc7a9945dc63c.tar.xz netdata-d4dd00f58a502c9ca4b63e36ce6bc7a9945dc63c.zip |
New upstream version 1.10.0+dfsgupstream/1.10.0+dfsg
Diffstat (limited to 'src/rrdsetvar.c')
-rw-r--r-- | src/rrdsetvar.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/rrdsetvar.c b/src/rrdsetvar.c index 280156a8a..aec57efa9 100644 --- a/src/rrdsetvar.c +++ b/src/rrdsetvar.c @@ -7,26 +7,27 @@ static inline void rrdsetvar_free_variables(RRDSETVAR *rs) { RRDSET *st = rs->rrdset; + RRDHOST *host = st->rrdhost; // ------------------------------------------------------------------------ // CHART - rrdvar_free(st->rrdhost, &st->rrdvar_root_index, rs->var_local); + rrdvar_free(host, &st->rrdvar_root_index, rs->var_local); rs->var_local = NULL; // ------------------------------------------------------------------------ // FAMILY - rrdvar_free(st->rrdhost, &st->rrdfamily->rrdvar_root_index, rs->var_family); + rrdvar_free(host, &st->rrdfamily->rrdvar_root_index, rs->var_family); rs->var_family = NULL; - rrdvar_free(st->rrdhost, &st->rrdfamily->rrdvar_root_index, rs->var_family_name); + rrdvar_free(host, &st->rrdfamily->rrdvar_root_index, rs->var_family_name); rs->var_family_name = NULL; // ------------------------------------------------------------------------ // HOST - rrdvar_free(st->rrdhost, &st->rrdhost->rrdvar_root_index, rs->var_host); + rrdvar_free(host, &host->rrdvar_root_index, rs->var_host); rs->var_host = NULL; - rrdvar_free(st->rrdhost, &st->rrdhost->rrdvar_root_index, rs->var_host_name); + rrdvar_free(host, &host->rrdvar_root_index, rs->var_host_name); rs->var_host_name = NULL; // ------------------------------------------------------------------------ @@ -40,6 +41,7 @@ static inline void rrdsetvar_free_variables(RRDSETVAR *rs) { static inline void rrdsetvar_create_variables(RRDSETVAR *rs) { RRDSET *st = rs->rrdset; + RRDHOST *host = st->rrdhost; // ------------------------------------------------------------------------ // free the old ones (if any) @@ -67,8 +69,8 @@ static inline void rrdsetvar_create_variables(RRDSETVAR *rs) { // ------------------------------------------------------------------------ // HOST - rs->var_host = rrdvar_create_and_index("host", &st->rrdhost->rrdvar_root_index, rs->key_fullid, rs->type, rs->value); - rs->var_host_name = rrdvar_create_and_index("host", &st->rrdhost->rrdvar_root_index, rs->key_fullname, rs->type, rs->value); + rs->var_host = rrdvar_create_and_index("host", &host->rrdvar_root_index, rs->key_fullid, rs->type, rs->value); + rs->var_host_name = rrdvar_create_and_index("host", &host->rrdvar_root_index, rs->key_fullname, rs->type, rs->value); } RRDSETVAR *rrdsetvar_create(RRDSET *st, const char *variable, RRDVAR_TYPE type, void *value, RRDVAR_OPTIONS options) { @@ -128,6 +130,8 @@ void rrdsetvar_free(RRDSETVAR *rs) { // custom chart variables RRDSETVAR *rrdsetvar_custom_chart_variable_create(RRDSET *st, const char *name) { + RRDHOST *host = st->rrdhost; + char *n = strdupz(name); rrdvar_fix_name(n); uint32_t hash = simple_hash(n); @@ -144,7 +148,7 @@ RRDSETVAR *rrdsetvar_custom_chart_variable_create(RRDSET *st, const char *name) return rs; } else { - error("RRDSETVAR: custom variable '%s' on chart '%s' of host '%s', conflicts with an internal chart variable", n, st->id, st->rrdhost->hostname); + error("RRDSETVAR: custom variable '%s' on chart '%s' of host '%s', conflicts with an internal chart variable", n, st->id, host->hostname); free(n); return NULL; } |