diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2022-07-20 13:20:07 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2022-07-20 13:20:07 +0200 |
commit | 6b59fc85570cdced437ae92d694c8e4620e4809a (patch) | |
tree | 15a6d3da4d446fdec843de121022a7137497c02a /src/plugins/irc | |
parent | b7441bd7a30e1fdee837fad9923d372b4b283374 (diff) | |
download | weechat-6b59fc85570cdced437ae92d694c8e4620e4809a.zip |
irc: use API function string_rebuild_split_string in irc_protocol_string_params
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 35 |
1 files changed, 3 insertions, 32 deletions
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 (""); } /* |