From: Ruben Kerkhof Date: Mon, 1 Aug 2016 20:05:11 +0000 (+0200) Subject: amqp: use C99 designated initializers X-Git-Tag: collectd-5.6.0~132^2~7 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=028a9dfa0c77ebf3c9219cf38facede3b03a1ebb;p=collectd.git amqp: use C99 designated initializers --- diff --git a/src/amqp.c b/src/amqp.c index 9a20f4a1..9bc3175c 100644 --- a/src/amqp.c +++ b/src/amqp.c @@ -763,16 +763,20 @@ static int camqp_subscribe_init (camqp_config_t *conf) /* {{{ */ static int camqp_write_locked (camqp_config_t *conf, /* {{{ */ const char *buffer, const char *routing_key) { - amqp_basic_properties_t props = { 0 }; int status; status = camqp_connect (conf); if (status != 0) return (status); - props._flags = AMQP_BASIC_CONTENT_TYPE_FLAG - | AMQP_BASIC_DELIVERY_MODE_FLAG - | AMQP_BASIC_APP_ID_FLAG; + amqp_basic_properties_t props = { + ._flags = AMQP_BASIC_CONTENT_TYPE_FLAG + | AMQP_BASIC_DELIVERY_MODE_FLAG + | AMQP_BASIC_APP_ID_FLAG, + .delivery_mode = conf->delivery_mode, + .app_id = amqp_cstring_bytes("collectd") + }; + if (conf->format == CAMQP_FORMAT_COMMAND) props.content_type = amqp_cstring_bytes("text/collectd"); else if (conf->format == CAMQP_FORMAT_JSON) @@ -781,8 +785,6 @@ static int camqp_write_locked (camqp_config_t *conf, /* {{{ */ props.content_type = amqp_cstring_bytes("text/graphite"); else assert (23 == 42); - props.delivery_mode = conf->delivery_mode; - props.app_id = amqp_cstring_bytes("collectd"); status = amqp_basic_publish(conf->connection, /* channel = */ 1,