#include "collectd.h"
-#include "common.h"
#include "plugin.h"
+#include "utils/common/common.h"
#include <arpa/inet.h>
#include <errno.h>
if (dest_size > dest_len) { \
sstrncpy((dest) + dest_len, (src), dest_size - dest_len); \
} \
- (dest)[dest_size - 1] = 0; \
+ (dest)[dest_size - 1] = '\0'; \
} while (0)
static int ceph_cb_number(void *ctx, const char *number_val,
}
memmove(state->key, key, sz - 1);
- state->key[sz - 1] = 0;
+ state->key[sz - 1] = '\0';
return CEPH_CB_CONTINUE;
}
static int cconn_process_data(struct cconn *io, yajl_struct *yajl,
yajl_handle hand) {
int ret;
- struct values_tmp *vtmp = calloc(1, sizeof(struct values_tmp) * 1);
+ struct values_tmp *vtmp = calloc(1, sizeof(*vtmp));
if (!vtmp) {
return -ENOMEM;
}
size_t cmd_len = strlen(cmd);
RETRY_ON_EINTR(
ret, write(io->asok, ((char *)&cmd) + io->amt, cmd_len - io->amt));
- DEBUG("ceph plugin: cconn_handle_event(name=%s,state=%d,amt=%d,ret=%d)",
+ DEBUG("ceph plugin: cconn_handle_event(name=%s,state=%d,amt=%d,ret=%zd)",
io->d->name, io->state, io->amt, ret);
if (ret < 0) {
return ret;
case CSTATE_READ_VERSION: {
RETRY_ON_EINTR(ret, read(io->asok, ((char *)(&io->d->version)) + io->amt,
sizeof(io->d->version) - io->amt));
- DEBUG("ceph plugin: cconn_handle_event(name=%s,state=%d,ret=%d)",
+ DEBUG("ceph plugin: cconn_handle_event(name=%s,state=%d,ret=%zd)",
io->d->name, io->state, ret);
if (ret < 0) {
return ret;
case CSTATE_READ_AMT: {
RETRY_ON_EINTR(ret, read(io->asok, ((char *)(&io->json_len)) + io->amt,
sizeof(io->json_len) - io->amt));
- DEBUG("ceph plugin: cconn_handle_event(name=%s,state=%d,ret=%d)",
+ DEBUG("ceph plugin: cconn_handle_event(name=%s,state=%d,ret=%zd)",
io->d->name, io->state, ret);
if (ret < 0) {
return ret;
case CSTATE_READ_JSON: {
RETRY_ON_EINTR(ret,
read(io->asok, io->json + io->amt, io->json_len - io->amt));
- DEBUG("ceph plugin: cconn_handle_event(name=%s,state=%d,ret=%d)",
+ DEBUG("ceph plugin: cconn_handle_event(name=%s,state=%d,ret=%zd)",
io->d->name, io->state, ret);
if (ret < 0) {
return ret;