From: Ruben Kerkhof Date: Mon, 1 Aug 2016 20:31:31 +0000 (+0200) Subject: ceph plugin: no need to zero the whole array X-Git-Tag: collectd-5.6.0~132^2~4 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6ff0b7c87a1a599d157c766f1a57799ae7bebed6;p=collectd.git ceph plugin: no need to zero the whole array also use '\0' not 0 while we're here --- diff --git a/src/ceph.c b/src/ceph.c index c34d209e..34aa7b16 100644 --- a/src/ceph.c +++ b/src/ceph.c @@ -259,7 +259,7 @@ static int ceph_cb_boolean(void *ctx, int bool_val) #define BUFFER_ADD(dest, src) do { \ size_t dest_size = sizeof (dest); \ strncat ((dest), (src), dest_size - strlen (dest)); \ - (dest)[dest_size - 1] = 0; \ + (dest)[dest_size - 1] = '\0'; \ } while (0) static int @@ -267,13 +267,14 @@ ceph_cb_number(void *ctx, const char *number_val, yajl_len_t number_len) { yajl_struct *state = (yajl_struct*) ctx; char buffer[number_len+1]; - char key[2 * DATA_MAX_NAME_LEN] = { 0 }; + char key[2 * DATA_MAX_NAME_LEN]; _Bool latency_type = 0; size_t i; int status; + key[0] = '\0'; memcpy(buffer, number_val, number_len); - buffer[sizeof(buffer) - 1] = 0; + buffer[sizeof(buffer) - 1] = '\0'; for (i = 0; i < state->depth; i++) { @@ -591,7 +592,7 @@ static int ceph_daemon_add_ds_entry(struct ceph_daemon *d, const char *name, int pc_type) { uint32_t type; - char ds_name[DATA_MAX_NAME_LEN] = { 0 }; + char ds_name[DATA_MAX_NAME_LEN]; if(convert_special_metrics) { @@ -979,7 +980,7 @@ static int node_handler_fetch_data(void *arg, const char *val, const char *key) uint32_t type = DSET_TYPE_UNFOUND; int index = vtmp->index; - char ds_name[DATA_MAX_NAME_LEN] = { 0 }; + char ds_name[DATA_MAX_NAME_LEN]; if (parse_keys (ds_name, sizeof (ds_name), key)) {