From: Aleksei Zakharov Date: Thu, 19 Oct 2017 07:25:34 +0000 (+0000) Subject: ceph plugin: Make cut_suffix void, change var names X-Git-Tag: collectd-5.8.0~29^2~3 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=9bb21a2b154cb12e3c96280dac9cdabf969c4b79;p=collectd.git ceph plugin: Make cut_suffix void, change var names --- diff --git a/src/ceph.c b/src/ceph.c index 523bc75f..0b064de3 100644 --- a/src/ceph.c +++ b/src/ceph.c @@ -485,7 +485,7 @@ static _Bool has_suffix(char const *str, char const *suffix) { return 0; } -static int cut_suffix(char new_str[], size_t new_str_len, char const *str, +static void cut_suffix(char *buffer, size_t buffer_size, char const *str, char const *suffix) { size_t str_len = strlen(str); @@ -493,13 +493,11 @@ static int cut_suffix(char new_str[], size_t new_str_len, char const *str, size_t offset = str_len - suffix_len + 1; - if (offset > new_str_len) { - offset = new_str_len; + if (offset > buffer_size) { + offset = buffer_size; } - sstrncpy(new_str, str, offset); - - return 0; + sstrncpy(buffer, str, offset); } /* count_parts returns the number of elements a "foo.bar.baz" style key has. */