From 9bb21a2b154cb12e3c96280dac9cdabf969c4b79 Mon Sep 17 00:00:00 2001 From: Aleksei Zakharov Date: Thu, 19 Oct 2017 07:25:34 +0000 Subject: [PATCH] ceph plugin: Make cut_suffix void, change var names --- src/ceph.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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. */ -- 2.11.0