@cryptotaxi247 / netdata-1 / commits / 7b6362767

Rename struct fields from class to classification. (#11019)

These fields made our headers incompatible with C++, because `class` is a reserved keyword.

vkalintiris committed Apr 23, 2021 at 16:16 UTC 7b6362767e71b09ad1604de45c754e798c7dd169
9 files changed +31 -31
database/rrd.h
+1 -1
@@ -668,7 +668,7 @@ struct alarm_entry {
668
669 char *family;
670
671 - char *class;
671 + char *classification;
672 char *component;
673 char *type;
674
database/rrdcalc.c
+5 -5
@@ -91,7 +91,7 @@ static void rrdsetcalc_link(RRDSET *st, RRDCALC *rc) {
91 rc->name,
92 rc->rrdset->id,
93 rc->rrdset->family,
94 - rc->class,
94 + rc->classification,
95 rc->component,
96 rc->type,
97 rc->exec,
@@ -168,7 +168,7 @@ inline void rrdsetcalc_unlink(RRDCALC *rc) {
168 rc->name,
169 rc->rrdset->id,
170 rc->rrdset->family,
171 - rc->class,
171 + rc->classification,
172 rc->component,
173 rc->type,
174 rc->exec,
@@ -434,7 +434,7 @@ inline RRDCALC *rrdcalc_create_from_template(RRDHOST *host, RRDCALCTEMPLATE *rt,
434 if(rt->units) rc->units = strdupz(rt->units);
435 if(rt->info) rc->info = strdupz(rt->info);
436
437 - if (rt->class) rc->class = strdupz(rt->class);
437 + if (rt->classification) rc->classification = strdupz(rt->classification);
438 if (rt->component) rc->component = strdupz(rt->component);
439 if (rt->type) rc->type = strdupz(rt->type);
440
@@ -545,7 +545,7 @@ inline RRDCALC *rrdcalc_create_from_rrdcalc(RRDCALC *rc, RRDHOST *host, const ch
545 if(rc->units) newrc->units = strdupz(rc->units);
546 if(rc->info) newrc->info = strdupz(rc->info);
547
548 - if (rc->class) newrc->class = strdupz(rc->class);
548 + if (rc->classification) newrc->classification = strdupz(rc->classification);
549 if (rc->component) newrc->component = strdupz(rc->component);
550 if (rc->type) newrc->type = strdupz(rc->type);
551
@@ -587,7 +587,7 @@ void rrdcalc_free(RRDCALC *rc) {
587 freez(rc->source);
588 freez(rc->units);
589 freez(rc->info);
590 - freez(rc->class);
590 + freez(rc->classification);
591 freez(rc->component);
592 freez(rc->type);
593 simple_pattern_free(rc->spdim);
database/rrdcalc.h
+1 -1
@@ -42,7 +42,7 @@ struct rrdcalc {
42 char *exec; // the command to execute when this alarm switches state
43 char *recipient; // the recipient of the alarm (the first parameter to exec)
44
45 - char *class; // the class that this alarm belongs
45 + char *classification; // the class that this alarm belongs
46 char *component; // the component that this alarm refers to
47 char *type; // type of the alarm
48
database/rrdcalctemplate.h
+1 -1
@@ -15,7 +15,7 @@ struct rrdcalctemplate {
15 char *exec;
16 char *recipient;
17
18 - char *class;
18 + char *classification;
19 char *component;
20 char *type;
21
health/health.c
+2 -2
@@ -930,7 +930,7 @@ void *health_main(void *ptr) {
930 if(likely(!rrdcalc_isrepeating(rc))) {
931 ALARM_ENTRY *ae = health_create_alarm_entry(
932 host, rc->id, rc->next_event_id++, now, rc->name, rc->rrdset->id,
933 - rc->rrdset->family, rc->class, rc->component, rc->type, rc->exec, rc->recipient, now - rc->last_status_change,
933 + rc->rrdset->family, rc->classification, rc->component, rc->type, rc->exec, rc->recipient, now - rc->last_status_change,
934 rc->old_value, rc->value, rc->status, status, rc->source, rc->units, rc->info,
935 rc->delay_last,
936 (
@@ -980,7 +980,7 @@ void *health_main(void *ptr) {
980 rc->last_repeat = now;
981 ALARM_ENTRY *ae = health_create_alarm_entry(
982 host, rc->id, rc->next_event_id++, now, rc->name, rc->rrdset->id,
983 - rc->rrdset->family, rc->class, rc->component, rc->type, rc->exec, rc->recipient, now - rc->last_status_change,
983 + rc->rrdset->family, rc->classification, rc->component, rc->type, rc->exec, rc->recipient, now - rc->last_status_change,
984 rc->old_value, rc->value, rc->old_status, rc->status, rc->source, rc->units, rc->info,
985 rc->delay_last,
986 (
health/health.h
+1 -1
@@ -67,7 +67,7 @@ extern ALARM_ENTRY* health_create_alarm_entry(
67 const char *name,
68 const char *chart,
69 const char *family,
70 - const char *class,
70 + const char *classification,
71 const char *component,
72 const char *type,
73 const char *exec,
health/health_config.c
+12 -12
@@ -707,15 +707,15 @@ static int health_readfile(const char *filename, void *data) {
707 rc->hash_chart = simple_hash(rc->chart);
708 }
709 else if(hash == hash_class && !strcasecmp(key, HEALTH_CLASS_KEY)) {
710 - if(rc->class) {
711 - if(strcmp(rc->class, value) != 0)
710 + if(rc->classification) {
711 + if(strcmp(rc->classification, value) != 0)
712 error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
713 - line, filename, rc->name, key, rc->class, value, value);
713 + line, filename, rc->name, key, rc->classification, value, value);
714
715 - freez(rc->class);
715 + freez(rc->classification);
716 }
717 - rc->class = strdupz(value);
718 - strip_quotes(rc->class);
717 + rc->classification = strdupz(value);
718 + strip_quotes(rc->classification);
719 }
720 else if(hash == hash_component && !strcasecmp(key, HEALTH_COMPONENT_KEY)) {
721 if(rc->component) {
@@ -892,15 +892,15 @@ static int health_readfile(const char *filename, void *data) {
892 rt->hash_context = simple_hash(rt->context);
893 }
894 else if(hash == hash_class && !strcasecmp(key, HEALTH_CLASS_KEY)) {
895 - if(rt->class) {
896 - if(strcmp(rt->class, value) != 0)
895 + if(rt->classification) {
896 + if(strcmp(rt->classification, value) != 0)
897 error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
898 - line, filename, rt->name, key, rt->class, value, value);
898 + line, filename, rt->name, key, rt->classification, value, value);
899
900 - freez(rt->class);
900 + freez(rt->classification);
901 }
902 - rt->class = strdupz(value);
903 - strip_quotes(rt->class);
902 + rt->classification = strdupz(value);
903 + strip_quotes(rt->classification);
904 }
905 else if(hash == hash_component && !strcasecmp(key, HEALTH_COMPONENT_KEY)) {
906 if(rt->component) {
health/health_json.c
+2 -2
@@ -55,7 +55,7 @@ void health_alarm_entry2json_nolock(BUFFER *wb, ALARM_ENTRY *ae, RRDHOST *host)
55 , ae->name
56 , ae->chart
57 , ae->family
58 - , ae->class?ae->class:"Unknown"
58 + , ae->classification?ae->classification:"Unknown"
59 , ae->component?ae->component:"Unknown"
60 , ae->type?ae->type:"Unknown"
61 , (ae->flags & HEALTH_ENTRY_FLAG_PROCESSED)?"true":"false"
@@ -215,7 +215,7 @@ static inline void health_rrdcalc2json_nolock(RRDHOST *host, BUFFER *wb, RRDCALC
215 , rc->name
216 , rc->chart
217 , (rc->rrdset && rc->rrdset->family)?rc->rrdset->family:""
218 - , rc->class?rc->class:"Unknown"
218 + , rc->classification?rc->classification:"Unknown"
219 , rc->component?rc->component:"Unknown"
220 , rc->type?rc->type:"Unknown"
221 , (rc->rrdset)?"true":"false"
health/health_log.c
+6 -6
@@ -146,7 +146,7 @@ inline void health_alarm_log_save(RRDHOST *host, ALARM_ENTRY *ae) {
146 , ae->new_value
147 , ae->old_value
148 , (uint64_t)ae->last_repeat
149 - , (ae->class)?ae->class:"Unknown"
149 + , (ae->classification)?ae->classification:"Unknown"
150 , (ae->component)?ae->component:"Unknown"
151 , (ae->type)?ae->type:"Unknown"
152 ) < 0))
@@ -369,9 +369,9 @@ static inline ssize_t health_alarm_log_read(RRDHOST *host, FILE *fp, const char
369 ae->last_repeat = last_repeat;
370
371 if (likely(entries > 28)) {
372 - freez(ae->class);
373 - ae->class = strdupz(pointers[28]);
374 - if(!*ae->class) { freez(ae->class); ae->class = NULL; }
372 + freez(ae->classification);
373 + ae->classification = strdupz(pointers[28]);
374 + if(!*ae->classification) { freez(ae->classification); ae->classification = NULL; }
375
376 freez(ae->component);
377 ae->component = strdupz(pointers[29]);
@@ -491,7 +491,7 @@ inline ALARM_ENTRY* health_create_alarm_entry(
491 ae->family = strdupz(family);
492
493 if (class)
494 - ae->class = strdupz(class);
494 + ae->classification = strdupz(class);
495
496 if (component)
497 ae->component = strdupz(component);
@@ -595,7 +595,7 @@ inline void health_alarm_log_free_one_nochecks_nounlink(ALARM_ENTRY *ae) {
595 freez(ae->name);
596 freez(ae->chart);
597 freez(ae->family);
598 - freez(ae->class);
598 + freez(ae->classification);
599 freez(ae->component);
600 freez(ae->type);
601 freez(ae->exec);