X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fceph.c;h=804514ca99b2261e687f5da8a6cc251e1dd6eed3;hb=6e41c3b1f024d7944e5e8010a87933555c662474;hp=3accbd3f80d20a8d9b3c5c8e28af961c2d613aa9;hpb=196f5bd17880d91ba0da33a8f5f6168d039cfa0c;p=collectd.git diff --git a/src/ceph.c b/src/ceph.c index 3accbd3f..804514ca 100644 --- a/src/ceph.c +++ b/src/ceph.c @@ -280,7 +280,7 @@ static int ceph_cb_number(void *ctx, const char *number_val, * the same type of other "Bytes". Instead of keeping an "average" or * "rate", use the "sum" in the pair and assign that to the derive * value. */ - if (convert_special_metrics && (state->depth >= 2) && + if (convert_special_metrics && (state->depth > 2) && (strcmp("filestore", state->stack[state->depth - 2]) == 0) && (strcmp("journal_wr_bytes", state->stack[state->depth - 1]) == 0) && (strcmp("avgcount", state->key) == 0)) { @@ -404,8 +404,8 @@ static int compact_ds_name(char *buffer, size_t buffer_size, char const *src) { size_t src_len; char *ptr = buffer; size_t ptr_size = buffer_size; - _Bool append_plus = 0; - _Bool append_minus = 0; + bool append_plus = false; + bool append_minus = false; if ((buffer == NULL) || (buffer_size <= strlen("Minus")) || (src == NULL)) return EINVAL; @@ -415,11 +415,11 @@ static int compact_ds_name(char *buffer, size_t buffer_size, char const *src) { /* Remove trailing "+" and "-". */ if (src_copy[src_len - 1] == '+') { - append_plus = 1; + append_plus = true; src_len--; src_copy[src_len] = 0; } else if (src_copy[src_len - 1] == '-') { - append_minus = 1; + append_minus = true; src_len--; src_copy[src_len] = 0; } @@ -470,19 +470,19 @@ static int compact_ds_name(char *buffer, size_t buffer_size, char const *src) { return 0; } -static _Bool has_suffix(char const *str, char const *suffix) { +static bool has_suffix(char const *str, char const *suffix) { size_t str_len = strlen(str); size_t suffix_len = strlen(suffix); size_t offset; if (suffix_len > str_len) - return 0; + return false; offset = str_len - suffix_len; if (strcmp(str + offset, suffix) == 0) - return 1; + return true; - return 0; + return false; } static void cut_suffix(char *buffer, size_t buffer_size, char const *str, @@ -1341,7 +1341,7 @@ static int cconn_main_loop(uint32_t request_type) { struct cconn *io = io_array + i; ret = cconn_prepare(io, fds + nfds); if (ret < 0) { - WARNING("ceph plugin: cconn_prepare(name=%s,i=%zu,st=%d)=%d", + WARNING("ceph plugin: cconn_prepare(name=%s,i=%" PRIsz ",st=%d)=%d", io->d->name, i, io->state, ret); cconn_close(io); io->request_type = ASOK_REQ_NONE;