From: Sebastian Harl Date: Tue, 6 Oct 2015 20:17:29 +0000 (+0200) Subject: store: Use full initializers for store objects. X-Git-Tag: sysdb-0.8.0~12 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=894ed7e3743e1cd4913454b2bc086ff5d18c04b4;p=sysdb.git store: Use full initializers for store objects. Older versions of GCC/CLANG don't handle "missing" field initializers well. --- diff --git a/src/core/plugin.c b/src/core/plugin.c index 3611be4..728e20c 100644 --- a/src/core/plugin.c +++ b/src/core/plugin.c @@ -1485,7 +1485,7 @@ sdb_plugin_query(sdb_ast_node_t *ast, int sdb_plugin_store_host(const char *name, sdb_time_t last_update) { - sdb_store_host_t host = { 0 }; + sdb_store_host_t host = SDB_STORE_HOST_INIT; char *backends[1]; char *cname; @@ -1530,7 +1530,7 @@ int sdb_plugin_store_service(const char *hostname, const char *name, sdb_time_t last_update) { - sdb_store_service_t service = { 0 }; + sdb_store_service_t service = SDB_STORE_SERVICE_INIT; char *backends[1]; char *cname; @@ -1588,7 +1588,7 @@ int sdb_plugin_store_metric(const char *hostname, const char *name, sdb_metric_store_t *store, sdb_time_t last_update) { - sdb_store_metric_t metric = { 0 }; + sdb_store_metric_t metric = SDB_STORE_METRIC_INIT; char *backends[1]; char *cname; @@ -1653,7 +1653,7 @@ int sdb_plugin_store_attribute(const char *hostname, const char *key, const sdb_data_t *value, sdb_time_t last_update) { - sdb_store_attribute_t attr = { 0 }; + sdb_store_attribute_t attr = SDB_STORE_ATTRIBUTE_INIT; char *backends[1]; char *cname; @@ -1701,7 +1701,7 @@ int sdb_plugin_store_service_attribute(const char *hostname, const char *service, const char *key, const sdb_data_t *value, sdb_time_t last_update) { - sdb_store_attribute_t attr = { 0 }; + sdb_store_attribute_t attr = SDB_STORE_ATTRIBUTE_INIT; char *backends[1]; char *cname; @@ -1750,7 +1750,7 @@ int sdb_plugin_store_metric_attribute(const char *hostname, const char *metric, const char *key, const sdb_data_t *value, sdb_time_t last_update) { - sdb_store_attribute_t attr = { 0 }; + sdb_store_attribute_t attr = SDB_STORE_ATTRIBUTE_INIT; char *backends[1]; char *cname; diff --git a/src/include/core/store.h b/src/include/core/store.h index 0cee913..4038fe4 100644 --- a/src/include/core/store.h +++ b/src/include/core/store.h @@ -121,6 +121,7 @@ typedef struct { const char * const *backends; size_t backends_num; } sdb_store_host_t; +#define SDB_STORE_HOST_INIT { NULL, 0, 0, NULL, 0 } /* * sdb_store_service_t represents the meta-data of a stored service object. @@ -134,6 +135,7 @@ typedef struct { const char * const *backends; size_t backends_num; } sdb_store_service_t; +#define SDB_STORE_SERVICE_INIT { NULL, NULL, 0, 0, NULL, 0 } /* * sdb_metric_store_t specifies how to access a metric's data. @@ -159,6 +161,7 @@ typedef struct { const char * const *backends; size_t backends_num; } sdb_store_metric_t; +#define SDB_STORE_METRIC_INIT { NULL, NULL, { NULL, NULL }, 0, 0, NULL, 0 } /* * sdb_store_attribute_t represents a stored attribute. @@ -175,6 +178,7 @@ typedef struct { const char * const *backends; size_t backends_num; } sdb_store_attribute_t; +#define SDB_STORE_ATTRIBUTE_INIT { NULL, 0, NULL, NULL, SDB_DATA_INIT, 0, 0, NULL, 0 } /* * Expressions represent arithmetic expressions based on stored objects and