From 6b59fc85570cdced437ae92d694c8e4620e4809a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Wed, 20 Jul 2022 13:20:07 +0200 Subject: irc: use API function string_rebuild_split_string in irc_protocol_string_params --- src/plugins/irc/irc-protocol.c | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) (limited to 'src/plugins/irc') diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 4d13381c5..15c4428f7 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -333,40 +333,11 @@ irc_protocol_parse_time (const char *time) char * irc_protocol_string_params (const char **params, int arg_start, int arg_end) { - int i, length; char *result; - if (!params || (arg_start < 0) || (arg_end < arg_start)) - return strdup (""); - - length = 0; - for (i = 0; params[i]; i++) - { - if (i > arg_end) - break; - if (i >= arg_start) - length += strlen (params[i]) + 1; - } - - if (length == 0) - return strdup (""); - - result = malloc (length + 1); - if (!result) - return NULL; - - result[0] = '\0'; - - for (i = arg_start; params[i]; i++) - { - if (i > arg_end) - break; - strcat (result, params[i]); - if ((i + 1 <= arg_end) && params[i + 1]) - strcat (result, " "); - } - - return result; + result = weechat_string_rebuild_split_string (params, " ", + arg_start, arg_end); + return (result) ? result : strdup (""); } /* -- cgit v1.2.3