From ffe9e206c8b66593298cd4526882b99fe0fc97fd Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 15 Dec 2023 09:44:52 +0100 Subject: [PATCH] common: Improve coding style of `strsplit`. * Combine declaration and initialization. --- src/utils/common/common.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/utils/common/common.c b/src/utils/common/common.c index c1d0d14a6..7caa1f51f 100644 --- a/src/utils/common/common.c +++ b/src/utils/common/common.c @@ -350,13 +350,9 @@ int swrite(int fd, const void *buf, size_t count) { } int strsplit(char *string, char **fields, size_t size) { - size_t i; - char *ptr; - char *saveptr; - - i = 0; - ptr = string; - saveptr = NULL; + size_t i = 0; + char *ptr = string; + char *saveptr = NULL; while ((fields[i] = strtok_r(ptr, " \t\r\n", &saveptr)) != NULL) { ptr = NULL; i++; -- 2.47.2