From: Florian Forster Date: Mon, 29 Sep 2008 12:56:43 +0000 (+0200) Subject: src/utils_complain.h: Rename `C_COMPLAIN_INIT' to `C_COMPLAIN_INIT_STATIC'. X-Git-Tag: collectd-4.6.0~199 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=7c84372528ab858cc8ea8a4bc6ee577f7ef3026a;hp=424adfdc39de5a338bfef18a150c0557b79d3b49;p=collectd.git src/utils_complain.h: Rename `C_COMPLAIN_INIT' to `C_COMPLAIN_INIT_STATIC'. Because it can only be used when initializing during declaration. A macro for initializing a struct by pointer as been added with the previous name, i. e. `C_COMPLAIN_INIT(c)'. Signed-off-by: Florian Forster --- diff --git a/src/plugin.c b/src/plugin.c index 2b5a34da..bef715ee 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -718,7 +718,7 @@ void plugin_shutdown_all (void) int plugin_dispatch_values (value_list_t *vl) { - static c_complain_t no_write_complaint = C_COMPLAIN_INIT; + static c_complain_t no_write_complaint = C_COMPLAIN_INIT_STATIC; int (*callback) (const data_set_t *, const value_list_t *); data_set_t *ds; diff --git a/src/postgresql.c b/src/postgresql.c index 9438c576..43f5af56 100644 --- a/src/postgresql.c +++ b/src/postgresql.c @@ -217,8 +217,7 @@ static c_psql_database_t *c_psql_database_new (const char *name) db->conn = NULL; - db->conn_complaint.last = 0; - db->conn_complaint.interval = 0; + C_COMPLAIN_INIT (&db->conn_complaint); db->proto_version = 0; diff --git a/src/utils_complain.h b/src/utils_complain.h index e93d823e..b51a81c6 100644 --- a/src/utils_complain.h +++ b/src/utils_complain.h @@ -39,7 +39,8 @@ typedef struct int interval; } c_complain_t; -#define C_COMPLAIN_INIT { 0, 0 } +#define C_COMPLAIN_INIT_STATIC { 0, 0 } +#define C_COMPLAIN_INIT(c) do { (c)->last = 0; (c)->interval = 0; } while (0) /* * NAME