From 7c84372528ab858cc8ea8a4bc6ee577f7ef3026a Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 29 Sep 2008 14:56:43 +0200 Subject: [PATCH] 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 --- src/plugin.c | 2 +- src/postgresql.c | 3 +-- src/utils_complain.h | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) 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 -- 2.30.2