1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 21:36:37 +02:00

Rename function string_explode to string_split

This commit is contained in:
Sebastien Helleu
2009-06-28 19:49:32 +02:00
parent 4a89b4ae59
commit 2f7a5a4147
37 changed files with 236 additions and 232 deletions
+2 -2
View File
@@ -127,7 +127,7 @@ alias_replace_args (const char *alias_args, const char *user_args)
const char *start, *pos;
int argc, length_res, args_count;
argv = weechat_string_explode (user_args, " ", 0, 0, &argc);
argv = weechat_string_split (user_args, " ", 0, 0, &argc);
res = NULL;
length_res = 0;
@@ -206,7 +206,7 @@ alias_replace_args (const char *alias_args, const char *user_args)
}
if (argv)
weechat_string_free_exploded (argv);
weechat_string_free_split (argv);
return res;
}
+5 -5
View File
@@ -67,7 +67,7 @@ weechat_aspell_config_change_commands (void *data,
if (weechat_aspell_commands_to_check)
{
weechat_string_free_exploded (weechat_aspell_commands_to_check);
weechat_string_free_split (weechat_aspell_commands_to_check);
weechat_aspell_commands_to_check = NULL;
weechat_aspell_count_commands_to_check = 0;
}
@@ -81,9 +81,9 @@ weechat_aspell_config_change_commands (void *data,
value = weechat_config_string (option);
if (value && value[0])
{
weechat_aspell_commands_to_check = weechat_string_explode (value,
",", 0, 0,
&weechat_aspell_count_commands_to_check);
weechat_aspell_commands_to_check = weechat_string_split (value,
",", 0, 0,
&weechat_aspell_count_commands_to_check);
if (weechat_aspell_count_commands_to_check > 0)
{
weechat_aspell_length_commands_to_check = malloc (weechat_aspell_count_commands_to_check *
@@ -381,7 +381,7 @@ weechat_aspell_config_free ()
weechat_config_free (weechat_aspell_config_file);
if (weechat_aspell_commands_to_check)
weechat_string_free_exploded (weechat_aspell_commands_to_check);
weechat_string_free_split (weechat_aspell_commands_to_check);
if (weechat_aspell_length_commands_to_check)
free (weechat_aspell_length_commands_to_check);
}
+2 -2
View File
@@ -80,7 +80,7 @@ weechat_aspell_speller_check_dictionaries (const char *dict_list)
if (dict_list)
{
argv = weechat_string_explode (dict_list, ",", 0, 0, &argc);
argv = weechat_string_split (dict_list, ",", 0, 0, &argc);
if (argv)
{
for (i = 0; i < argc; i++)
@@ -93,7 +93,7 @@ weechat_aspell_speller_check_dictionaries (const char *dict_list)
ASPELL_PLUGIN_NAME, argv[i]);
}
}
weechat_string_free_exploded (argv);
weechat_string_free_split (argv);
}
}
}
+4 -4
View File
@@ -281,7 +281,7 @@ weechat_aspell_spellers_already_ok (const char *dict_list)
rc = 0;
argv = weechat_string_explode (dict_list, ",", 0, 0, &argc);
argv = weechat_string_split (dict_list, ",", 0, 0, &argc);
if (argv)
{
ptr_speller = weechat_aspell_spellers;
@@ -294,7 +294,7 @@ weechat_aspell_spellers_already_ok (const char *dict_list)
}
ptr_speller = ptr_speller->next_speller;
}
weechat_string_free_exploded (argv);
weechat_string_free_split (argv);
}
return rc;
@@ -319,14 +319,14 @@ weechat_aspell_create_spellers (struct t_gui_buffer *buffer)
weechat_aspell_speller_free_all ();
if (dict_list)
{
argv = weechat_string_explode (dict_list, ",", 0, 0, &argc);
argv = weechat_string_split (dict_list, ",", 0, 0, &argc);
if (argv)
{
for (i = 0; i < argc; i++)
{
weechat_aspell_speller_new (argv[i]);
}
weechat_string_free_exploded (argv);
weechat_string_free_split (argv);
}
}
}
+2 -2
View File
@@ -193,7 +193,7 @@ demo_infolist_print (struct t_infolist *infolist, const char *item_name)
fields = weechat_infolist_fields (infolist);
if (fields)
{
argv = weechat_string_explode (fields, ",", 0, 0, &argc);
argv = weechat_string_split (fields, ",", 0, 0, &argc);
if (argv && (argc > 0))
{
for (j = 0; j < argc; j++)
@@ -237,7 +237,7 @@ demo_infolist_print (struct t_infolist *infolist, const char *item_name)
}
}
if (argv)
weechat_string_free_exploded (argv);
weechat_string_free_split (argv);
}
i++;
}
+6 -6
View File
@@ -768,8 +768,8 @@ irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
{
channel_name = argv[1];
pos_args = argv_eol[2];
channels = weechat_string_explode (channel_name, ",", 0, 0,
&num_channels);
channels = weechat_string_split (channel_name, ",", 0, 0,
&num_channels);
if (channels)
{
for (i = 0; i < num_channels; i++)
@@ -780,7 +780,7 @@ irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
(ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL))
ptr_channel->cycle = 1;
}
weechat_string_free_exploded (channels);
weechat_string_free_split (channels);
}
}
else
@@ -2003,8 +2003,8 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COMMAND_CHECK_SERVER("msg", 1);
targets = weechat_string_explode (argv[arg_target], ",", 0, 0,
&num_targets);
targets = weechat_string_split (argv[arg_target], ",", 0, 0,
&num_targets);
if (targets)
{
for (i = 0; i < num_targets; i++)
@@ -2118,7 +2118,7 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
}
}
}
weechat_string_free_exploded (targets);
weechat_string_free_split (targets);
}
return WEECHAT_RC_OK;
+4 -4
View File
@@ -574,16 +574,16 @@ irc_config_ignore_read (void *data,
{
if (value && value[0])
{
argv = weechat_string_explode (value, ";", 0, 0, &argc);
argv_eol = weechat_string_explode (value, ";", 1, 0, NULL);
argv = weechat_string_split (value, ";", 0, 0, &argc);
argv_eol = weechat_string_split (value, ";", 1, 0, NULL);
if (argv && argv_eol && (argc >= 3))
{
irc_ignore_new (argv_eol[2], argv[0], argv[1]);
}
if (argv)
weechat_string_free_exploded (argv);
weechat_string_free_split (argv);
if (argv_eol)
weechat_string_free_exploded (argv_eol);
weechat_string_free_split (argv_eol);
}
}
+2 -2
View File
@@ -78,7 +78,7 @@ irc_mode_channel_set (struct t_irc_server *server,
pos_args++;
while (pos_args[0] == ' ')
pos_args++;
argv = weechat_string_explode (pos_args, " ", 0, 0, &argc);
argv = weechat_string_split (pos_args, " ", 0, 0, &argc);
}
else
{
@@ -212,7 +212,7 @@ irc_mode_channel_set (struct t_irc_server *server,
if (str_modes)
free (str_modes);
if (argv)
weechat_string_free_exploded (argv);
weechat_string_free_split (argv);
weechat_bar_item_update ("buffer_name");
+4 -4
View File
@@ -4532,8 +4532,8 @@ irc_protocol_recv_command (struct t_irc_server *server, const char *entire_line,
}
else
dup_entire_line = NULL;
argv = weechat_string_explode (dup_entire_line, " ", 0, 0, &argc);
argv_eol = weechat_string_explode (dup_entire_line, " ", 1, 0, NULL);
argv = weechat_string_split (dup_entire_line, " ", 0, 0, &argc);
argv_eol = weechat_string_split (dup_entire_line, " ", 1, 0, NULL);
return_code = (int) (cmd_recv_func) (server, cmd_name,
argc, argv, argv_eol);
@@ -4556,8 +4556,8 @@ irc_protocol_recv_command (struct t_irc_server *server, const char *entire_line,
if (dup_entire_line)
free (dup_entire_line);
if (argv)
weechat_string_free_exploded (argv);
weechat_string_free_split (argv);
if (argv_eol)
weechat_string_free_exploded (argv_eol);
weechat_string_free_split (argv_eol);
}
}
+13 -13
View File
@@ -159,7 +159,7 @@ irc_server_set_addresses (struct t_irc_server *server, const char *addresses)
server->addresses_count = 0;
if (server->addresses_array)
{
weechat_string_free_exploded (server->addresses_array);
weechat_string_free_split (server->addresses_array);
server->addresses_array = NULL;
}
if (server->ports_array)
@@ -171,9 +171,9 @@ irc_server_set_addresses (struct t_irc_server *server, const char *addresses)
/* set new addresses/ports */
if (addresses && addresses[0])
{
server->addresses_array = weechat_string_explode (addresses,
",", 0, 0,
&server->addresses_count);
server->addresses_array = weechat_string_split (addresses,
",", 0, 0,
&server->addresses_count);
server->ports_array = malloc (server->addresses_count * sizeof (server->ports_array[0]));
for (i = 0; i < server->addresses_count; i++)
{
@@ -206,14 +206,14 @@ irc_server_set_nicks (struct t_irc_server *server, const char *nicks)
server->nicks_count = 0;
if (server->nicks_array)
{
weechat_string_free_exploded (server->nicks_array);
weechat_string_free_split (server->nicks_array);
server->nicks_array = NULL;
}
/* set new nicks */
server->nicks_array = weechat_string_explode ((nicks) ? nicks : IRC_SERVER_DEFAULT_NICKS,
",", 0, 0,
&server->nicks_count);
server->nicks_array = weechat_string_split ((nicks) ? nicks : IRC_SERVER_DEFAULT_NICKS,
",", 0, 0,
&server->nicks_count);
}
/*
@@ -611,13 +611,13 @@ irc_server_free_data (struct t_irc_server *server)
if (server->name)
free (server->name);
if (server->addresses_array)
weechat_string_free_exploded (server->addresses_array);
weechat_string_free_split (server->addresses_array);
if (server->ports_array)
free (server->ports_array);
if (server->current_ip)
free (server->current_ip);
if (server->nicks_array)
weechat_string_free_exploded (server->nicks_array);
weechat_string_free_split (server->nicks_array);
if (server->unterminated_message)
free (server->unterminated_message);
if (server->nick)
@@ -1230,14 +1230,14 @@ irc_server_sendf (struct t_irc_server *server, int queue_msg,
vsnprintf (buffer, sizeof (buffer) - 1, format, args);
va_end (args);
items = weechat_string_explode (buffer, "\n", 0, 0, &items_count);
items = weechat_string_split (buffer, "\n", 0, 0, &items_count);
for (i = 0; i < items_count; i++)
{
if (!irc_server_send_one_msg (server, queue_msg, items[i]))
break;
}
if (items)
weechat_string_free_exploded (items);
weechat_string_free_split (items);
}
/*
@@ -1334,7 +1334,7 @@ irc_server_msgq_add_unterminated (struct t_irc_server *server, const char *strin
}
/*
* irc_server_msgq_add_buffer: explode received buffer, creating queued messages
* irc_server_msgq_add_buffer: split received buffer, creating queued messages
*/
void
+2 -2
View File
@@ -102,7 +102,7 @@ struct t_irc_server
int reloading_from_config; /* 1 if reloading from config file */
int reloaded_from_config; /* 1 if reloaded from config file */
int addresses_count; /* number of addresses */
char **addresses_array; /* exploded addresses */
char **addresses_array; /* addresses (after split) */
int *ports_array; /* ports for addresses */
int index_current_address; /* current address index in array */
char *current_ip; /* current IP address */
@@ -116,7 +116,7 @@ struct t_irc_server
#endif
char *unterminated_message; /* beginning of a message in input buf */
int nicks_count; /* number of nicknames */
char **nicks_array; /* exploded nicknames */
char **nicks_array; /* nicknames (after split) */
char *nick; /* current nickname */
char *nick_modes; /* nick modes */
char *prefix; /* nick prefix allowed (from msg 005) */
+3 -3
View File
@@ -372,9 +372,9 @@ plugin_load (const char *filename)
new_plugin->string_strip = &string_strip;
new_plugin->string_has_highlight = &string_has_highlight;
new_plugin->string_mask_to_regex = &string_mask_to_regex;
new_plugin->string_explode = &string_explode;
new_plugin->string_free_exploded = &string_free_exploded;
new_plugin->string_build_with_exploded = &string_build_with_exploded;
new_plugin->string_split = &string_split;
new_plugin->string_free_split = &string_free_split;
new_plugin->string_build_with_split_string = &string_build_with_split_string;
new_plugin->string_split_command = &string_split_command;
new_plugin->string_free_split_command = &string_free_split_command;
new_plugin->string_format_size = &string_format_size;
+2 -2
View File
@@ -152,7 +152,7 @@ relay_client_send_infolist (struct t_relay_client *client,
fields = weechat_infolist_fields (infolist);
if (fields)
{
argv = weechat_string_explode (fields, ",", 0, 0, &argc);
argv = weechat_string_split (fields, ",", 0, 0, &argc);
if (argv && (argc > 0))
{
for (i = 0; i < argc; i++)
@@ -193,7 +193,7 @@ relay_client_send_infolist (struct t_relay_client *client,
}
}
if (argv)
weechat_string_free_exploded (argv);
weechat_string_free_split (argv);
}
}
}
+1 -1
View File
@@ -3651,7 +3651,7 @@ weechat_lua_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
lua_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
lua_argv[1] = script_ptr2str (buffer);
lua_argv[2] = timebuffer;
lua_argv[3] = weechat_string_build_with_exploded (tags, ",");
lua_argv[3] = weechat_string_build_with_split_string (tags, ",");
if (!lua_argv[3])
lua_argv[3] = strdup ("");
lua_argv[4] = (displayed) ? strdup ("1") : strdup ("0");
+1 -1
View File
@@ -3080,7 +3080,7 @@ weechat_perl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
perl_argv[1] = script_ptr2str (buffer);
perl_argv[2] = timebuffer;
perl_argv[3] = weechat_string_build_with_exploded (tags, ",");
perl_argv[3] = weechat_string_build_with_split_string (tags, ",");
if (!perl_argv[3])
perl_argv[3] = strdup ("");
perl_argv[4] = (displayed) ? strdup ("1") : strdup ("0");
@@ -3253,7 +3253,7 @@ weechat_python_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
python_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
python_argv[1] = script_ptr2str (buffer);
python_argv[2] = timebuffer;
python_argv[3] = weechat_string_build_with_exploded (tags, ",");
python_argv[3] = weechat_string_build_with_split_string (tags, ",");
if (!python_argv[3])
python_argv[3] = strdup ("");
python_argv[4] = (displayed) ? strdup ("1") : strdup ("0");
+1 -1
View File
@@ -3760,7 +3760,7 @@ weechat_ruby_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
ruby_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
ruby_argv[1] = script_ptr2str (buffer);
ruby_argv[2] = timebuffer;
ruby_argv[3] = weechat_string_build_with_exploded (tags, ",");
ruby_argv[3] = weechat_string_build_with_split_string (tags, ",");
if (!ruby_argv[3])
ruby_argv[3] = strdup ("");
ruby_argv[4] = (displayed) ? strdup ("1") : strdup ("0");
+4 -4
View File
@@ -922,7 +922,7 @@ script_action_install (struct t_weechat_plugin *weechat_plugin,
if (*list)
{
argv = weechat_string_explode (*list, ",", 0, 0, &argc);
argv = weechat_string_split (*list, ",", 0, 0, &argc);
if (argv)
{
for (i = 0; i < argc; i++)
@@ -995,7 +995,7 @@ script_action_install (struct t_weechat_plugin *weechat_plugin,
free (name);
}
}
weechat_string_free_exploded (argv);
weechat_string_free_split (argv);
}
free (*list);
*list = NULL;
@@ -1021,7 +1021,7 @@ script_action_remove (struct t_weechat_plugin *weechat_plugin,
if (*list)
{
argv = weechat_string_explode (*list, ",", 0, 0, &argc);
argv = weechat_string_split (*list, ",", 0, 0, &argc);
if (argv)
{
for (i = 0; i < argc; i++)
@@ -1034,7 +1034,7 @@ script_action_remove (struct t_weechat_plugin *weechat_plugin,
/* remove script file(s) */
script_remove_file (weechat_plugin, argv[i], 1);
}
weechat_string_free_exploded (argv);
weechat_string_free_split (argv);
}
free (*list);
*list = NULL;
+1 -1
View File
@@ -3498,7 +3498,7 @@ weechat_tcl_api_hook_print_cb (void *data, struct t_gui_buffer *buffer,
tcl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg;
tcl_argv[1] = script_ptr2str (buffer);
tcl_argv[2] = timebuffer;
tcl_argv[3] = weechat_string_build_with_exploded (tags, ",");
tcl_argv[3] = weechat_string_build_with_split_string (tags, ",");
if (!tcl_argv[3])
tcl_argv[3] = strdup ("");
tcl_argv[4] = (displayed) ? strdup ("1") : strdup ("0");
+15 -15
View File
@@ -160,11 +160,11 @@ struct t_weechat_plugin
int (*string_has_highlight) (const char *string,
const char *highlight_words);
char *(*string_mask_to_regex) (const char *mask);
char **(*string_explode) (const char *string, const char *separators,
int keep_eol, int num_items_max, int *num_items);
void (*string_free_exploded) (char **exploded_string);
char *(*string_build_with_exploded) (const char **exploded_string,
const char *separator);
char **(*string_split) (const char *string, const char *separators,
int keep_eol, int num_items_max, int *num_items);
void (*string_free_split) (char **split_string);
char *(*string_build_with_split_string) (const char **split_string,
const char *separator);
char **(*string_split_command) (const char *command, char separator);
void (*string_free_split_command) (char **split_command);
char *(*string_format_size) (unsigned long size);
@@ -691,16 +691,16 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
weechat_plugin->string_has_highlight(__string, __highlight_words)
#define weechat_string_mask_to_regex(__mask) \
weechat_plugin->string_mask_to_regex(__mask)
#define weechat_string_explode(__string, __separator, __eol, __max, \
__num_items) \
weechat_plugin->string_explode(__string, __separator, __eol, \
__max, __num_items)
#define weechat_string_free_exploded(__exploded_string) \
weechat_plugin->string_free_exploded(__exploded_string)
#define weechat_string_build_with_exploded(__exploded_string, \
__separator) \
weechat_plugin->string_build_with_exploded(__exploded_string, \
__separator)
#define weechat_string_split(__string, __separator, __eol, __max, \
__num_items) \
weechat_plugin->string_split(__string, __separator, __eol, \
__max, __num_items)
#define weechat_string_free_split(__split_string) \
weechat_plugin->string_free_split(__split_string)
#define weechat_string_build_with_split_string(__split_string, \
__separator) \
weechat_plugin->string_build_with_split_string(__split_string, \
__separator)
#define weechat_string_split_command(__command, __separator) \
weechat_plugin->string_split_command(__command, __separator)
#define weechat_string_free_split_command(__split_command) \