X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fceph.c;h=04a397434d1b7c228fc5a885a424ebbb9101c230;hb=354f9991530248e45207d236eb74c1cc3d5238ef;hp=251def9cd66ae1f21dd23c13eafd827f9f9fd0f0;hpb=f7f5868ee0378791ccd8d1788e27ebf2a02737dc;p=collectd.git diff --git a/src/ceph.c b/src/ceph.c index 251def9c..04a39743 100644 --- a/src/ceph.c +++ b/src/ceph.c @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include @@ -97,7 +96,7 @@ enum ceph_dset_type_d }; /** Valid types for ceph defined in types.db */ -const char * ceph_dset_types [CEPH_DSET_TYPES_NUM] = +static const char * const ceph_dset_types [CEPH_DSET_TYPES_NUM] = {"ceph_latency", "ceph_bytes", "ceph_rate"}; /******* ceph_daemon *******/ @@ -624,7 +623,7 @@ static int ceph_daemon_add_ds_entry(struct ceph_daemon *d, const char *name, return -ENOMEM; } - d->ds_names[d->ds_num] = malloc(sizeof(char) * DATA_MAX_NAME_LEN); + d->ds_names[d->ds_num] = malloc(DATA_MAX_NAME_LEN); if(!d->ds_names[d->ds_num]) { return -ENOMEM; @@ -748,7 +747,7 @@ static int cc_add_daemon_config(oconfig_item_t *ci) } g_daemons = tmp; - nd = malloc(sizeof(*nd)); + nd = malloc(sizeof (*nd)); if(!nd) { return ENOMEM; @@ -846,7 +845,7 @@ node_handler_define_schema(void *arg, const char *val, const char *key) static int add_last(struct ceph_daemon *d, const char *ds_n, double cur_sum, uint64_t cur_count) { - d->last_poll_data[d->last_idx] = malloc(1 * sizeof(struct last_data)); + d->last_poll_data[d->last_idx] = malloc(sizeof (*d->last_poll_data[d->last_idx])); if(!d->last_poll_data[d->last_idx]) { return -ENOMEM; @@ -874,7 +873,7 @@ static int update_last(struct ceph_daemon *d, const char *ds_n, int index, if(!d->last_poll_data) { - d->last_poll_data = malloc(1 * sizeof(struct last_data *)); + d->last_poll_data = malloc(sizeof (*d->last_poll_data)); if(!d->last_poll_data) { return -ENOMEM; @@ -1097,7 +1096,7 @@ static int cconn_connect(struct cconn *io) fd = socket(PF_UNIX, SOCK_STREAM, 0); if(fd < 0) { - int err = -errno; + err = -errno; ERROR("ceph plugin: cconn_connect: socket(PF_UNIX, SOCK_STREAM, 0) " "failed: error %d", err); return err; @@ -1546,7 +1545,7 @@ static int cconn_main_loop(uint32_t request_type) } else { - int ret = cconn_handle_event(io); + ret = cconn_handle_event(io); if(ret) { WARNING("ceph plugin: cconn_handle_event(name=%s,"