summaryrefslogtreecommitdiffstats
path: root/database
diff options
context:
space:
mode:
authorvkalintiris <vasilis@netdata.cloud>2021-03-10 10:37:47 +0200
committerGitHub <noreply@github.com>2021-03-10 10:37:47 +0200
commitadec24dffa763654bfa8cfa9ae3bd53296c2c24f (patch)
tree63f5307373399ed797e2721fadfa2f83971a61b9 /database
parent86ca37683eac5ffd4172c5e62652409087791999 (diff)
Rename struct avl to avl_element and the typedef to avl_t (#10735)
Before: ``` struct foobar { avl avl; ... } ``` After: ``` struct foobar { avl_t avl; ... }; ``` Which makes figuring out the type from field name easier.
Diffstat (limited to 'database')
-rw-r--r--database/engine/rrdengine.h2
-rw-r--r--database/rrd.h14
-rw-r--r--database/rrdcalc.c14
-rw-r--r--database/rrdcalc.h2
-rw-r--r--database/rrddim.c10
-rw-r--r--database/rrdfamily.c6
-rw-r--r--database/rrdhost.c6
-rw-r--r--database/rrdset.c12
-rw-r--r--database/rrdvar.c6
-rw-r--r--database/rrdvar.h2
10 files changed, 37 insertions, 37 deletions
diff --git a/database/engine/rrdengine.h b/database/engine/rrdengine.h
index a2003636e5..2d48665f83 100644
--- a/database/engine/rrdengine.h
+++ b/database/engine/rrdengine.h
@@ -234,4 +234,4 @@ extern void rrdeng_worker(void* arg);
extern void rrdeng_enq_cmd(struct rrdengine_worker_config* wc, struct rrdeng_cmd *cmd);
extern struct rrdeng_cmd rrdeng_deq_cmd(struct rrdengine_worker_config* wc);
-#endif /* NETDATA_RRDENGINE_H */ \ No newline at end of file
+#endif /* NETDATA_RRDENGINE_H */
diff --git a/database/rrd.h b/database/rrd.h
index b826aff280..fd7e4275e3 100644
--- a/database/rrd.h
+++ b/database/rrd.h
@@ -130,7 +130,7 @@ extern const char *rrd_algorithm_name(RRD_ALGORITHM algorithm);
// RRD FAMILY
struct rrdfamily {
- avl avl;
+ avl_t avl;
const char *family;
uint32_t hash_family;
@@ -235,7 +235,7 @@ struct rrddim {
// ------------------------------------------------------------------------
// binary indexing structures
- avl avl; // the binary index - this has to be first member!
+ avl_t avl; // the binary index - this has to be first member!
// ------------------------------------------------------------------------
// the dimension definition
@@ -474,8 +474,8 @@ struct rrdset {
// ------------------------------------------------------------------------
// binary indexing structures
- avl avl; // the index, with key the id - this has to be first!
- avl avlname; // the index, with key the name
+ avl_t avl; // the index, with key the id - this has to be first!
+ avl_t avlname; // the index, with key the name
// ------------------------------------------------------------------------
// the set configuration
@@ -727,7 +727,7 @@ struct rrdhost_system_info {
};
struct rrdhost {
- avl avl; // the index of hosts
+ avl_t avl; // the index of hosts
// ------------------------------------------------------------------------
// host information
@@ -1286,8 +1286,8 @@ extern int rrdfamily_compare(void *a, void *b);
extern RRDFAMILY *rrdfamily_create(RRDHOST *host, const char *id);
extern void rrdfamily_free(RRDHOST *host, RRDFAMILY *rc);
-#define rrdset_index_add(host, st) (RRDSET *)avl_insert_lock(&((host)->rrdset_root_index), (avl *)(st))
-#define rrdset_index_del(host, st) (RRDSET *)avl_remove_lock(&((host)->rrdset_root_index), (avl *)(st))
+#define rrdset_index_add(host, st) (RRDSET *)avl_insert_lock(&((host)->rrdset_root_index), (avl_t *)(st))
+#define rrdset_index_del(host, st) (RRDSET *)avl_remove_lock(&((host)->rrdset_root_index), (avl_t *)(st))
extern RRDSET *rrdset_index_del_name(RRDHOST *host, RRDSET *st);
extern void rrdset_free(RRDSET *st);
diff --git a/database/rrdcalc.c b/database/rrdcalc.c
index 935ee9c055..bc91da64f3 100644
--- a/database/rrdcalc.c
+++ b/database/rrdcalc.c
@@ -472,7 +472,7 @@ inline RRDCALC *rrdcalc_create_from_template(RRDHOST *host, RRDCALCTEMPLATE *rt,
rrdcalc_add_to_host(host, rc);
if(!rt->foreachdim) {
- RRDCALC *rdcmp = (RRDCALC *) avl_insert_lock(&(host)->alarms_idx_health_log,(avl *)rc);
+ RRDCALC *rdcmp = (RRDCALC *) avl_insert_lock(&(host)->alarms_idx_health_log,(avl_t *)rc);
if (rdcmp != rc) {
error("Cannot insert the alarm index ID %s",rc->name);
}
@@ -605,17 +605,17 @@ void rrdcalc_unlink_and_free(RRDHOST *host, RRDCALC *rc) {
error("Cannot unlink alarm '%s.%s' from host '%s': not found", rc->chart?rc->chart:"NOCHART", rc->name, host->hostname);
}
- RRDCALC *rdcmp = (RRDCALC *) avl_search_lock(&(host)->alarms_idx_health_log, (avl *)rc);
+ RRDCALC *rdcmp = (RRDCALC *) avl_search_lock(&(host)->alarms_idx_health_log, (avl_t *)rc);
if (rdcmp) {
- rdcmp = (RRDCALC *) avl_remove_lock(&(host)->alarms_idx_health_log, (avl *)rc);
+ rdcmp = (RRDCALC *) avl_remove_lock(&(host)->alarms_idx_health_log, (avl_t *)rc);
if (!rdcmp) {
error("Cannot remove the health alarm index from health_log");
}
}
- rdcmp = (RRDCALC *) avl_search_lock(&(host)->alarms_idx_name, (avl *)rc);
+ rdcmp = (RRDCALC *) avl_search_lock(&(host)->alarms_idx_name, (avl_t *)rc);
if (rdcmp) {
- rdcmp = (RRDCALC *) avl_remove_lock(&(host)->alarms_idx_name, (avl *)rc);
+ rdcmp = (RRDCALC *) avl_remove_lock(&(host)->alarms_idx_name, (avl_t *)rc);
if (!rdcmp) {
error("Cannot remove the health alarm index from idx_name");
}
@@ -727,7 +727,7 @@ void rrdcalc_labels_unlink() {
int alarm_isrepeating(RRDHOST *host, uint32_t alarm_id) {
RRDCALC findme;
findme.id = alarm_id;
- RRDCALC *rc = (RRDCALC *)avl_search_lock(&host->alarms_idx_health_log, (avl *)&findme);
+ RRDCALC *rc = (RRDCALC *)avl_search_lock(&host->alarms_idx_health_log, (avl_t *)&findme);
if (!rc) {
return 0;
}
@@ -761,7 +761,7 @@ RRDCALC *alarm_max_last_repeat(RRDHOST *host, char *alarm_name,uint32_t hash) {
RRDCALC findme;
findme.name = alarm_name;
findme.hash = hash;
- RRDCALC *rc = (RRDCALC *)avl_search_lock(&host->alarms_idx_name, (avl *)&findme);
+ RRDCALC *rc = (RRDCALC *)avl_search_lock(&host->alarms_idx_name, (avl_t *)&findme);
return rc;
}
diff --git a/database/rrdcalc.h b/database/rrdcalc.h
index cd0d70049f..27ff99a89b 100644
--- a/database/rrdcalc.h
+++ b/database/rrdcalc.h
@@ -32,7 +32,7 @@
struct rrdcalc {
- avl avl; // the index, with key the id - this has to be first!
+ avl_t avl; // the index, with key the id - this has to be first!
uint32_t id; // the unique id of this alarm
uint32_t next_event_id; // the next event id that will be used for this alarm
diff --git a/database/rrddim.c b/database/rrddim.c
index 6a1408595c..621d6cfa75 100644
--- a/database/rrddim.c
+++ b/database/rrddim.c
@@ -38,15 +38,15 @@ int rrddim_compare(void* a, void* b) {
else return strcmp(((RRDDIM *)a)->id, ((RRDDIM *)b)->id);
}
-#define rrddim_index_add(st, rd) (RRDDIM *)avl_insert_lock(&((st)->dimensions_index), (avl *)(rd))
-#define rrddim_index_del(st,rd ) (RRDDIM *)avl_remove_lock(&((st)->dimensions_index), (avl *)(rd))
+#define rrddim_index_add(st, rd) (RRDDIM *)avl_insert_lock(&((st)->dimensions_index), (avl_t *)(rd))
+#define rrddim_index_del(st,rd ) (RRDDIM *)avl_remove_lock(&((st)->dimensions_index), (avl_t *)(rd))
static inline RRDDIM *rrddim_index_find(RRDSET *st, const char *id, uint32_t hash) {
RRDDIM tmp = {
.id = id,
.hash = (hash)?hash:simple_hash(id)
};
- return (RRDDIM *)avl_search_lock(&(st->dimensions_index), (avl *) &tmp);
+ return (RRDDIM *)avl_search_lock(&(st->dimensions_index), (avl_t *) &tmp);
}
@@ -197,7 +197,7 @@ void rrdcalc_link_to_rrddim(RRDDIM *rd, RRDSET *st, RRDHOST *host) {
RRDCALC *child = rrdcalc_create_from_rrdcalc(rrdc, host, usename, rd->name);
if (child) {
rrdcalc_add_to_host(host, child);
- RRDCALC *rdcmp = (RRDCALC *) avl_insert_lock(&(host)->alarms_idx_health_log,(avl *)child);
+ RRDCALC *rdcmp = (RRDCALC *) avl_insert_lock(&(host)->alarms_idx_health_log,(avl_t *)child);
if (rdcmp != child) {
error("Cannot insert the alarm index ID %s",child->name);
}
@@ -277,7 +277,7 @@ RRDDIM *rrddim_add_custom(RRDSET *st, const char *id, const char *name, collecte
if(likely(rd)) {
// we have a file mapped for rd
- memset(&rd->avl, 0, sizeof(avl));
+ memset(&rd->avl, 0, sizeof(avl_t));
rd->id = NULL;
rd->name = NULL;
rd->cache_filename = NULL;
diff --git a/database/rrdfamily.c b/database/rrdfamily.c
index f75f0adc3e..3d91c37887 100644
--- a/database/rrdfamily.c
+++ b/database/rrdfamily.c
@@ -12,15 +12,15 @@ int rrdfamily_compare(void *a, void *b) {
else return strcmp(((RRDFAMILY *)a)->family, ((RRDFAMILY *)b)->family);
}
-#define rrdfamily_index_add(host, rc) (RRDFAMILY *)avl_insert_lock(&((host)->rrdfamily_root_index), (avl *)(rc))
-#define rrdfamily_index_del(host, rc) (RRDFAMILY *)avl_remove_lock(&((host)->rrdfamily_root_index), (avl *)(rc))
+#define rrdfamily_index_add(host, rc) (RRDFAMILY *)avl_insert_lock(&((host)->rrdfamily_root_index), (avl_t *)(rc))
+#define rrdfamily_index_del(host, rc) (RRDFAMILY *)avl_remove_lock(&((host)->rrdfamily_root_index), (avl_t *)(rc))
static RRDFAMILY *rrdfamily_index_find(RRDHOST *host, const char *id, uint32_t hash) {
RRDFAMILY tmp;
tmp.family = id;
tmp.hash_family = (hash)?hash:simple_hash(tmp.family);
- return (RRDFAMILY *)avl_search_lock(&(host->rrdfamily_root_index), (avl *) &tmp);
+ return (RRDFAMILY *)avl_search_lock(&(host->rrdfamily_root_index), (avl_t *) &tmp);
}
RRDFAMILY *rrdfamily_create(RRDHOST *host, const char *id) {
diff --git a/database/rrdhost.c b/database/rrdhost.c
index b9a5a002e4..79a0aab14a 100644
--- a/database/rrdhost.c
+++ b/database/rrdhost.c
@@ -31,7 +31,7 @@ RRDHOST *rrdhost_find_by_guid(const char *guid, uint32_t hash) {
strncpyz(tmp.machine_guid, guid, GUID_LEN);
tmp.hash_machine_guid = (hash)?hash:simple_hash(tmp.machine_guid);
- return (RRDHOST *)avl_search_lock(&(rrdhost_root_index), (avl *) &tmp);
+ return (RRDHOST *)avl_search_lock(&(rrdhost_root_index), (avl_t *) &tmp);
}
RRDHOST *rrdhost_find_by_hostname(const char *hostname, uint32_t hash) {
@@ -53,8 +53,8 @@ RRDHOST *rrdhost_find_by_hostname(const char *hostname, uint32_t hash) {
return NULL;
}
-#define rrdhost_index_add(rrdhost) (RRDHOST *)avl_insert_lock(&(rrdhost_root_index), (avl *)(rrdhost))
-#define rrdhost_index_del(rrdhost) (RRDHOST *)avl_remove_lock(&(rrdhost_root_index), (avl *)(rrdhost))
+#define rrdhost_index_add(rrdhost) (RRDHOST *)avl_insert_lock(&(rrdhost_root_index), (avl_t *)(rrdhost))
+#define rrdhost_index_del(rrdhost) (RRDHOST *)avl_remove_lock(&(rrdhost_root_index), (avl_t *)(rrdhost))
// ----------------------------------------------------------------------------
diff --git a/database/rrdset.c b/database/rrdset.c
index e9c6eee5cf..5fb178b093 100644
--- a/database/rrdset.c
+++ b/database/rrdset.c
@@ -35,7 +35,7 @@ static RRDSET *rrdset_index_find(RRDHOST *host, const char *id, uint32_t hash) {
strncpyz(tmp.id, id, RRD_ID_LENGTH_MAX);
tmp.hash = (hash)?hash:simple_hash(tmp.id);
- return (RRDSET *)avl_search_lock(&(host->rrdset_root_index), (avl *) &tmp);
+ return (RRDSET *)avl_search_lock(&(host->rrdset_root_index), (avl_t *) &tmp);
}
// ----------------------------------------------------------------------------
@@ -57,7 +57,7 @@ int rrdset_compare_name(void* a, void* b) {
RRDSET *rrdset_index_add_name(RRDHOST *host, RRDSET *st) {
void *result;
// fprintf(stderr, "ADDING: %s (name: %s)\n", st->id, st->name);
- result = avl_insert_lock(&host->rrdset_root_index_name, (avl *) (&st->avlname));
+ result = avl_insert_lock(&host->rrdset_root_index_name, (avl_t *) (&st->avlname));
if(result) return rrdset_from_avlname(result);
return NULL;
}
@@ -65,7 +65,7 @@ RRDSET *rrdset_index_add_name(RRDHOST *host, RRDSET *st) {
RRDSET *rrdset_index_del_name(RRDHOST *host, RRDSET *st) {
void *result;
// fprintf(stderr, "DELETING: %s (name: %s)\n", st->id, st->name);
- result = (RRDSET *)avl_remove_lock(&((host)->rrdset_root_index_name), (avl *)(&st->avlname));
+ result = (RRDSET *)avl_remove_lock(&((host)->rrdset_root_index_name), (avl_t *)(&st->avlname));
if(result) return rrdset_from_avlname(result);
return NULL;
}
@@ -81,7 +81,7 @@ static inline RRDSET *rrdset_index_find_name(RRDHOST *host, const char *name, ui
tmp.hash_name = (hash)?hash:simple_hash(tmp.name);
// fprintf(stderr, "SEARCHING: %s\n", name);
- result = avl_search_lock(&host->rrdset_root_index_name, (avl *) (&(tmp.avlname)));
+ result = avl_search_lock(&host->rrdset_root_index_name, (avl_t *) (&(tmp.avlname)));
if(result) {
RRDSET *st = rrdset_from_avlname(result);
if(strcmp(st->magic, RRDSET_MAGIC) != 0)
@@ -744,8 +744,8 @@ RRDSET *rrdset_create_custom(
);
if(st) {
- memset(&st->avl, 0, sizeof(avl));
- memset(&st->avlname, 0, sizeof(avl));
+ memset(&st->avl, 0, sizeof(avl_t));
+ memset(&st->avlname, 0, sizeof(avl_t));
memset(&st->rrdvar_root_index, 0, sizeof(avl_tree_lock));
memset(&st->dimensions_index, 0, sizeof(avl_tree_lock));
memset(&st->rrdset_rwlock, 0, sizeof(netdata_rwlock_t));
diff --git a/database/rrdvar.c b/database/rrdvar.c
index 6b824d0d3f..25b8ca69ee 100644
--- a/database/rrdvar.c
+++ b/database/rrdvar.c
@@ -27,7 +27,7 @@ int rrdvar_compare(void* a, void* b) {
}
static inline RRDVAR *rrdvar_index_add(avl_tree_lock *tree, RRDVAR *rv) {
- RRDVAR *ret = (RRDVAR *)avl_insert_lock(tree, (avl *)(rv));
+ RRDVAR *ret = (RRDVAR *)avl_insert_lock(tree, (avl_t *)(rv));
if(ret != rv)
debug(D_VARIABLES, "Request to insert RRDVAR '%s' into index failed. Already exists.", rv->name);
@@ -35,7 +35,7 @@ static inline RRDVAR *rrdvar_index_add(avl_tree_lock *tree, RRDVAR *rv) {
}
static inline RRDVAR *rrdvar_index_del(avl_tree_lock *tree, RRDVAR *rv) {
- RRDVAR *ret = (RRDVAR *)avl_remove_lock(tree, (avl *)(rv));
+ RRDVAR *ret = (RRDVAR *)avl_remove_lock(tree, (avl_t *)(rv));
if(!ret)
error("Request to remove RRDVAR '%s' from index failed. Not Found.", rv->name);
@@ -47,7 +47,7 @@ static inline RRDVAR *rrdvar_index_find(avl_tree_lock *tree, const char *name, u
tmp.name = (char *)name;
tmp.hash = (hash)?hash:simple_hash(tmp.name);
- return (RRDVAR *)avl_search_lock(tree, (avl *)&tmp);
+ return (RRDVAR *)avl_search_lock(tree, (avl_t *)&tmp);
}
inline void rrdvar_free(RRDHOST *host, avl_tree_lock *tree, RRDVAR *rv) {
diff --git a/database/rrdvar.h b/database/rrdvar.h
index 6d1461b2aa..ec6e80a432 100644
--- a/database/rrdvar.h
+++ b/database/rrdvar.h
@@ -32,7 +32,7 @@ typedef enum rrdvar_options {
// 2. at each context (RRDFAMILY.rrdvar_root_index)
// 3. at each host (RRDHOST.rrdvar_root_index)
struct rrdvar {
- avl avl;
+ avl_t avl;
char *name;
uint32_t hash;