summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-config-file.c12
-rw-r--r--src/core/wee-config.c16
-rw-r--r--src/core/wee-hook.c28
-rw-r--r--src/core/wee-string.c60
-rw-r--r--src/core/wee-string.h10
-rw-r--r--src/core/wee-upgrade-file.c4
-rw-r--r--src/gui/curses/gui-curses-bar-window.c4
-rw-r--r--src/gui/gui-bar-window.c6
-rw-r--r--src/gui/gui-bar.c26
-rw-r--r--src/gui/gui-bar.h4
-rw-r--r--src/gui/gui-buffer.c16
-rw-r--r--src/gui/gui-filter.c6
-rw-r--r--src/gui/gui-line.c6
-rw-r--r--src/plugins/alias/alias.c4
-rw-r--r--src/plugins/aspell/weechat-aspell-config.c10
-rw-r--r--src/plugins/aspell/weechat-aspell-speller.c4
-rw-r--r--src/plugins/aspell/weechat-aspell.c8
-rw-r--r--src/plugins/demo/demo.c4
-rw-r--r--src/plugins/irc/irc-command.c12
-rw-r--r--src/plugins/irc/irc-config.c8
-rw-r--r--src/plugins/irc/irc-mode.c4
-rw-r--r--src/plugins/irc/irc-protocol.c8
-rw-r--r--src/plugins/irc/irc-server.c26
-rw-r--r--src/plugins/irc/irc-server.h4
-rw-r--r--src/plugins/plugin.c6
-rw-r--r--src/plugins/relay/relay-client.c4
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c2
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c2
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c2
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c2
-rw-r--r--src/plugins/scripts/script.c8
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c2
-rw-r--r--src/plugins/weechat-plugin.h30
33 files changed, 176 insertions, 172 deletions
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c
index a5ed67138..dbbc81384 100644
--- a/src/core/wee-config-file.c
+++ b/src/core/wee-config-file.c
@@ -453,9 +453,9 @@ config_file_new_option (struct t_config_file *config_file,
case CONFIG_OPTION_TYPE_INTEGER:
if (string_values && string_values[0])
{
- new_option->string_values = string_explode (string_values,
- "|", 0, 0,
- &argc);
+ new_option->string_values = string_split (string_values,
+ "|", 0, 0,
+ &argc);
if (!new_option->string_values)
goto error;
}
@@ -2291,7 +2291,7 @@ config_file_option_free_data (struct t_config_option *option)
if (option->description)
free (option->description);
if (option->string_values)
- string_free_exploded (option->string_values);
+ string_free_split (option->string_values);
if (option->default_value)
free (option->default_value);
if (option->value)
@@ -2557,8 +2557,8 @@ config_file_add_to_infolist (struct t_infolist *infolist,
free (option_full_name);
return 0;
}
- string_values = string_build_with_exploded ((const char **)ptr_option->string_values,
- "|");
+ string_values = string_build_with_split_string ((const char **)ptr_option->string_values,
+ "|");
if (!infolist_new_var_string (ptr_item,
"string_values",
string_values))
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 0a1be7c8c..02746cdbf 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -760,7 +760,7 @@ config_weechat_layout_read_cb (void *data, struct t_config_file *config_file,
{
if (string_strcasecmp (option_name, "buffer") == 0)
{
- argv = string_explode (value, ";", 0, 0, &argc);
+ argv = string_split (value, ";", 0, 0, &argc);
if (argv)
{
if (argc >= 3)
@@ -774,12 +774,12 @@ config_weechat_layout_read_cb (void *data, struct t_config_file *config_file,
argv[0], argv[1], number1);
}
}
- string_free_exploded (argv);
+ string_free_split (argv);
}
}
else if (string_strcasecmp (option_name, "window") == 0)
{
- argv = string_explode (value, ";", 0, 0, &argc);
+ argv = string_split (value, ";", 0, 0, &argc);
if (argv)
{
if (argc >= 6)
@@ -808,7 +808,7 @@ config_weechat_layout_read_cb (void *data, struct t_config_file *config_file,
argv[5] : NULL);
}
}
- string_free_exploded (argv);
+ string_free_split (argv);
}
}
}
@@ -1035,17 +1035,17 @@ config_weechat_filter_read_cb (void *data,
if (option_name && value && value[0])
{
- argv = string_explode (value, ";", 0, 0, &argc);
- argv_eol = string_explode (value, ";", 1, 0, NULL);
+ argv = string_split (value, ";", 0, 0, &argc);
+ argv_eol = string_split (value, ";", 1, 0, NULL);
if (argv && argv_eol && (argc >= 4))
{
gui_filter_new ((string_strcasecmp (argv[0], "on") == 0) ? 1 : 0,
option_name, argv[1], argv[2], argv_eol[3]);
}
if (argv)
- string_free_exploded (argv);
+ string_free_split (argv);
if (argv_eol)
- string_free_exploded (argv_eol);
+ string_free_split (argv_eol);
}
return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c
index e36b46f40..6b0dc0a04 100644
--- a/src/core/wee-hook.c
+++ b/src/core/wee-hook.c
@@ -426,9 +426,9 @@ hook_command_build_completion (struct t_hook_command *hook_command)
hook_command->cplt_templates_static[i] = strdup (hook_command->cplt_templates[i]);
/* build arguments for each template */
- hook_command->cplt_template_args[i] = string_explode (hook_command->cplt_templates[i],
- " ", 0, 0,
- &(hook_command->cplt_template_num_args[i]));
+ hook_command->cplt_template_args[i] = string_split (hook_command->cplt_templates[i],
+ " ", 0, 0,
+ &(hook_command->cplt_template_num_args[i]));
if (hook_command->cplt_template_num_args[i] > hook_command->cplt_template_num_args_concat)
hook_command->cplt_template_num_args_concat = hook_command->cplt_template_num_args[i];
}
@@ -464,8 +464,8 @@ hook_command_build_completion (struct t_hook_command *hook_command)
{
if (i < hook_command->cplt_template_num_args[j])
{
- items = string_explode (hook_command->cplt_template_args[j][i],
- "|", 0, 0, &num_items);
+ items = string_split (hook_command->cplt_template_args[j][i],
+ "|", 0, 0, &num_items);
for (k = 0; k < num_items; k++)
{
if (!weelist_search (list, items[k]))
@@ -478,7 +478,7 @@ hook_command_build_completion (struct t_hook_command *hook_command)
NULL);
}
}
- string_free_exploded (items);
+ string_free_split (items);
}
}
}
@@ -584,13 +584,13 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
rc = -1;
- argv = string_explode (string, " ", 0, 0, &argc);
+ argv = string_split (string, " ", 0, 0, &argc);
if (argc == 0)
{
- string_free_exploded (argv);
+ string_free_split (argv);
return -1;
}
- argv_eol = string_explode (string, " ", 1, 0, NULL);
+ argv_eol = string_split (string, " ", 1, 0, NULL);
hook_exec_start ();
@@ -660,8 +660,8 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
}
}
- string_free_exploded (argv);
- string_free_exploded (argv_eol);
+ string_free_split (argv);
+ string_free_split (argv_eol);
hook_exec_end ();
@@ -1516,8 +1516,8 @@ hook_print (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer,
new_hook_print->buffer = buffer;
if (tags)
{
- new_hook_print->tags_array = string_explode (tags, ",", 0, 0,
- &new_hook_print->tags_count);
+ new_hook_print->tags_array = string_split (tags, ",", 0, 0,
+ &new_hook_print->tags_count);
}
else
{
@@ -2173,7 +2173,7 @@ unhook (struct t_hook *hook)
free (HOOK_COMMAND(hook, cplt_templates)[i]);
if (HOOK_COMMAND(hook, cplt_templates_static)[i])
free (HOOK_COMMAND(hook, cplt_templates_static)[i]);
- string_free_exploded (HOOK_COMMAND(hook, cplt_template_args)[i]);
+ string_free_split (HOOK_COMMAND(hook, cplt_template_args)[i]);
}
free (HOOK_COMMAND(hook, cplt_templates));
}
diff --git a/src/core/wee-string.c b/src/core/wee-string.c
index 3b320c777..2ab59eae1 100644
--- a/src/core/wee-string.c
+++ b/src/core/wee-string.c
@@ -727,23 +727,23 @@ string_mask_to_regex (const char *mask)
}
/*
- * string_explode: explode a string according to separators
- * examples:
- * string_explode ("abc de fghi", " ", 0, 0, NULL)
- * ==> array[0] = "abc"
- * array[1] = "de"
- * array[2] = "fghi"
- * array[3] = NULL
- * string_explode ("abc de fghi", " ", 1, 0, NULL)
- * ==> array[0] = "abc de fghi"
- * array[1] = "de fghi"
- * array[2] = "fghi"
- * array[3] = NULL
+ * string_split: split a string according to separators
+ * examples:
+ * string_split ("abc de fghi", " ", 0, 0, NULL)
+ * ==> array[0] = "abc"
+ * array[1] = "de"
+ * array[2] = "fghi"
+ * array[3] = NULL
+ * string_split ("abc de fghi", " ", 1, 0, NULL)
+ * ==> array[0] = "abc de fghi"
+ * array[1] = "de fghi"
+ * array[2] = "fghi"
+ * array[3] = NULL
*/
char **
-string_explode (const char *string, const char *separators, int keep_eol,
- int num_items_max, int *num_items)
+string_split (const char *string, const char *separators, int keep_eol,
+ int num_items_max, int *num_items)
{
int i, j, n_items;
char *string2, **array;
@@ -867,42 +867,44 @@ string_explode (const char *string, const char *separators, int keep_eol,
}
/*
- * string_free_exploded: free an exploded string
+ * string_free_split: free a split string
*/
void
-string_free_exploded (char **exploded_string)
+string_free_split (char **split_string)
{
int i;
- if (exploded_string)
+ if (split_string)
{
- for (i = 0; exploded_string[i]; i++)
- free (exploded_string[i]);
- free (exploded_string);
+ for (i = 0; split_string[i]; i++)
+ free (split_string[i]);
+ free (split_string);
}
}
/*
- * string_build_with_exploded: build a string with exploded string
- * note: returned value has to be free() after use
+ * string_build_with_split_string: build a string with a split string
+ * note: returned value has to be free() after
+ * use
*/
char *
-string_build_with_exploded (const char **exploded_string, const char *separator)
+string_build_with_split_string (const char **split_string,
+ const char *separator)
{
int i, length, length_separator;
char *result;
- if (!exploded_string)
+ if (!split_string)
return NULL;
length = 0;
length_separator = (separator) ? strlen (separator) : 0;
- for (i = 0; exploded_string[i]; i++)
+ for (i = 0; split_string[i]; i++)
{
- length += strlen (exploded_string[i]) + length_separator;
+ length += strlen (split_string[i]) + length_separator;
}
result = malloc (length + 1);
@@ -910,10 +912,10 @@ string_build_with_exploded (const char **exploded_string, const char *separator)
{
result[0] = '\0';
- for (i = 0; exploded_string[i]; i++)
+ for (i = 0; split_string[i]; i++)
{
- strcat (result, exploded_string[i]);
- if (separator && exploded_string[i + 1])
+ strcat (result, split_string[i]);
+ if (separator && split_string[i + 1])
strcat (result, separator);
}
}
diff --git a/src/core/wee-string.h b/src/core/wee-string.h
index 7acbe3dc6..b4aafe13e 100644
--- a/src/core/wee-string.h
+++ b/src/core/wee-string.h
@@ -42,11 +42,11 @@ extern char *string_convert_hex_chars (const char *string);
extern int string_has_highlight (const char *string,
const char *highlight_words);
extern char *string_mask_to_regex (const char *mask);
-extern char **string_explode (const char *string, const char *separators,
- int keep_eol, int num_items_max, int *num_items);
-extern void string_free_exploded (char **exploded_string);
-extern char *string_build_with_exploded (const char **exploded_string,
- const char *separator);
+extern char **string_split (const char *string, const char *separators,
+ int keep_eol, int num_items_max, int *num_items);
+extern void string_free_split (char **split_string);
+extern char *string_build_with_split_string (const char **split_string,
+ const char *separator);
extern char **string_split_command (const char *command, char separator);
extern void string_free_split_command (char **split_command);
extern char *string_iconv (int from_utf8, const char *from_code,
diff --git a/src/core/wee-upgrade-file.c b/src/core/wee-upgrade-file.c
index 52f6d9e7a..b180b3dd2 100644
--- a/src/core/wee-upgrade-file.c
+++ b/src/core/wee-upgrade-file.c
@@ -263,7 +263,7 @@ upgrade_file_write_object (struct t_upgrade_file *upgrade_file, int object_id,
fields = infolist_fields (infolist);
if (fields)
{
- argv = string_explode (fields, ",", 0, 0, &argc);
+ argv = string_split (fields, ",", 0, 0, &argc);
if (argv && (argc > 0))
{
for (i = 0; i < argc; i++)
@@ -372,7 +372,7 @@ upgrade_file_write_object (struct t_upgrade_file *upgrade_file, int object_id,
}
}
if (argv)
- string_free_exploded (argv);
+ string_free_split (argv);
}
/* write object end */
diff --git a/src/gui/curses/gui-curses-bar-window.c b/src/gui/curses/gui-curses-bar-window.c
index c4c8f2167..85342c8a2 100644
--- a/src/gui/curses/gui-curses-bar-window.c
+++ b/src/gui/curses/gui-curses-bar-window.c
@@ -430,7 +430,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
content = gui_bar_window_content_get_with_filling (bar_window, window);
if (content)
{
- items = string_explode (content, "\n", 0, 0, &items_count);
+ items = string_split (content, "\n", 0, 0, &items_count);
if (items_count == 0)
{
if (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_SIZE]) == 0)
@@ -594,7 +594,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
}
}
if (items)
- string_free_exploded (items);
+ string_free_split (items);
free (content);
}
else
diff --git a/src/gui/gui-bar-window.c b/src/gui/gui-bar-window.c
index e97f20bd7..d610dbaf6 100644
--- a/src/gui/gui-bar-window.c
+++ b/src/gui/gui-bar-window.c
@@ -546,8 +546,8 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
i, sub);
if (ptr_content && ptr_content[0])
{
- split_items[i][sub] = string_explode (ptr_content,
- "\n", 0, 0, NULL);
+ split_items[i][sub] = string_split (ptr_content,
+ "\n", 0, 0, NULL);
for (j = 0; split_items[i][sub][j]; j++)
{
total_items++;
@@ -665,7 +665,7 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
for (sub = 0; sub < bar_window->items_subcount[i]; sub++)
{
if (split_items[i][sub])
- string_free_exploded (split_items[i][sub]);
+ string_free_split (split_items[i][sub]);
}
free (split_items[i]);
}
diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c
index 8e89d4d5f..9e0133187 100644
--- a/src/gui/gui-bar.c
+++ b/src/gui/gui-bar.c
@@ -681,7 +681,7 @@ gui_bar_free_items_array (struct t_gui_bar *bar)
for (i = 0; i < bar->items_count; i++)
{
if (bar->items_array[i])
- string_free_exploded (bar->items_array[i]);
+ string_free_split (bar->items_array[i]);
}
if (bar->items_array)
{
@@ -710,7 +710,7 @@ gui_bar_set_items_array (struct t_gui_bar *bar, const char *items)
if (items && items[0])
{
- tmp_array = string_explode (items, ",", 0, 0, &count);
+ tmp_array = string_split (items, ",", 0, 0, &count);
if (count > 0)
{
bar->items_count = count;
@@ -718,11 +718,11 @@ gui_bar_set_items_array (struct t_gui_bar *bar, const char *items)
bar->items_array = malloc (count * sizeof (*bar->items_array));
for (i = 0; i < count; i++)
{
- bar->items_array[i] = string_explode (tmp_array[i], "+", 0, 0,
- &(bar->items_subcount[i]));
+ bar->items_array[i] = string_split (tmp_array[i], "+", 0, 0,
+ &(bar->items_subcount[i]));
}
}
- string_free_exploded (tmp_array);
+ string_free_split (tmp_array);
}
}
@@ -856,14 +856,14 @@ gui_bar_config_change_conditions (void *data, struct t_config_option *option)
if (ptr_bar)
{
if (ptr_bar->conditions_array)
- string_free_exploded (ptr_bar->conditions_array);
+ string_free_split (ptr_bar->conditions_array);
if (CONFIG_STRING(ptr_bar->options[GUI_BAR_OPTION_CONDITIONS])
&& CONFIG_STRING(ptr_bar->options[GUI_BAR_OPTION_CONDITIONS])[0])
{
- ptr_bar->conditions_array = string_explode (CONFIG_STRING(ptr_bar->options[GUI_BAR_OPTION_CONDITIONS]),
- ",", 0, 0,
- &ptr_bar->conditions_count);
+ ptr_bar->conditions_array = string_split (CONFIG_STRING(ptr_bar->options[GUI_BAR_OPTION_CONDITIONS]),
+ ",", 0, 0,
+ &ptr_bar->conditions_count);
}
else
{
@@ -1523,9 +1523,9 @@ gui_bar_new_with_options (const char *name,
new_bar->options[GUI_BAR_OPTION_CONDITIONS] = conditions;
if (CONFIG_STRING(conditions) && CONFIG_STRING(conditions)[0])
{
- new_bar->conditions_array = string_explode (CONFIG_STRING(conditions),
- ",", 0, 0,
- &new_bar->conditions_count);
+ new_bar->conditions_array = string_split (CONFIG_STRING(conditions),
+ ",", 0, 0,
+ &new_bar->conditions_count);
}
else
{
@@ -2165,7 +2165,7 @@ gui_bar_free (struct t_gui_bar *bar)
config_file_option_free (bar->options[i]);
}
if (bar->conditions_array)
- string_free_exploded (bar->conditions_array);
+ string_free_split (bar->conditions_array);
gui_bar_free_items_array (bar);
free (bar);
diff --git a/src/gui/gui-bar.h b/src/gui/gui-bar.h
index 2a8f79694..d79c81c3c 100644
--- a/src/gui/gui-bar.h
+++ b/src/gui/gui-bar.h
@@ -85,10 +85,10 @@ struct t_gui_bar
/* internal vars */
int conditions_count; /* number of conditions */
- char **conditions_array; /* exploded bar conditions */
+ char **conditions_array; /* bar conditions (after split) */
int items_count; /* number of bar items */
int *items_subcount; /* number of sub items */
- char ***items_array; /* exploded bar items */
+ char ***items_array; /* bar items (after split) */
struct t_gui_bar_window *bar_window; /* pointer to bar window */
/* (for type root only) */
int bar_refresh_needed; /* refresh for bar is needed? */
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 8eefc2ef1..3a79a4059 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -872,16 +872,16 @@ gui_buffer_set_highlight_tags (struct t_gui_buffer *buffer,
if (buffer->highlight_tags)
free (buffer->highlight_tags);
if (buffer->highlight_tags_array)
- string_free_exploded (buffer->highlight_tags_array);
+ string_free_split (buffer->highlight_tags_array);
if (new_highlight_tags)
{
buffer->highlight_tags = strdup (new_highlight_tags);
if (buffer->highlight_tags)
{
- buffer->highlight_tags_array = string_explode (new_highlight_tags,
- ",", 0, 0,
- &buffer->highlight_tags_count);
+ buffer->highlight_tags_array = string_split (new_highlight_tags,
+ ",", 0, 0,
+ &buffer->highlight_tags_count);
}
}
else
@@ -1548,7 +1548,7 @@ gui_buffer_close (struct t_gui_buffer *buffer)
if (buffer->highlight_tags)
free (buffer->highlight_tags);
if (buffer->highlight_tags_array)
- string_free_exploded (buffer->highlight_tags_array);
+ string_free_split (buffer->highlight_tags_array);
gui_keyboard_free_all (&buffer->keys, &buffer->last_key);
gui_buffer_local_var_remove_all (buffer);
@@ -2288,7 +2288,8 @@ gui_buffer_dump_hexa (struct t_gui_buffer *buffer)
message_without_colors : "(null)");
if (message_without_colors)
free (message_without_colors);
- tags = string_build_with_exploded ((const char **)ptr_line->data->tags_array, ",");
+ tags = string_build_with_split_string ((const char **)ptr_line->data->tags_array,
+ ",");
log_printf (" tags: %s", (tags) ? tags : "(none)");
if (tags)
free (tags);
@@ -2450,7 +2451,8 @@ gui_buffer_print_log ()
while (ptr_line)
{
num--;
- tags = string_build_with_exploded ((const char **)ptr_line->data->tags_array, ",");
+ tags = string_build_with_split_string ((const char **)ptr_line->data->tags_array,
+ ",");
log_printf (" line N-%05d: y:%d, str_time:'%s', tags:'%s', "
"displayed:%d, highlight:%d, refresh_needed:%d, prefix:'%s'",
num, ptr_line->data->y, ptr_line->data->str_time,
diff --git a/src/gui/gui-filter.c b/src/gui/gui-filter.c
index b8e58b2e5..3aa2ce7a2 100644
--- a/src/gui/gui-filter.c
+++ b/src/gui/gui-filter.c
@@ -373,8 +373,8 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name,
if (tags)
{
new_filter->tags = (tags) ? strdup (tags) : NULL;
- new_filter->tags_array = string_explode (tags, ",", 0, 0,
- &new_filter->tags_count);
+ new_filter->tags_array = string_split (tags, ",", 0, 0,
+ &new_filter->tags_count);
}
else
{
@@ -443,7 +443,7 @@ gui_filter_free (struct t_gui_filter *filter)
if (filter->tags)
free (filter->tags);
if (filter->tags_array)
- string_free_exploded (filter->tags_array);
+ string_free_split (filter->tags_array);
if (filter->regex)
free (filter->regex);
if (filter->regex_prefix)
diff --git a/src/gui/gui-line.c b/src/gui/gui-line.c
index 0cf9a5c8e..7f155cf5a 100644
--- a/src/gui/gui-line.c
+++ b/src/gui/gui-line.c
@@ -483,7 +483,7 @@ gui_line_remove_from_list (struct t_gui_buffer *buffer,
if (line->data->str_time)
free (line->data->str_time);
if (line->data->tags_array)
- string_free_exploded (line->data->tags_array);
+ string_free_split (line->data->tags_array);
if (line->data->prefix)
free (line->data->prefix);
if (line->data->message)
@@ -692,8 +692,8 @@ gui_line_add (struct t_gui_buffer *buffer, time_t date,
NULL : gui_chat_get_time_string (date);
if (tags)
{
- new_line->data->tags_array = string_explode (tags, ",", 0, 0,
- &new_line->data->tags_count);
+ new_line->data->tags_array = string_split (tags, ",", 0, 0,
+ &new_line->data->tags_count);
}
else
{
diff --git a/src/plugins/alias/alias.c b/src/plugins/alias/alias.c
index fb215d1b8..dde3bf887 100644
--- a/src/plugins/alias/alias.c
+++ b/src/plugins/alias/alias.c
@@ -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;
}
diff --git a/src/plugins/aspell/weechat-aspell-config.c b/src/plugins/aspell/weechat-aspell-config.c
index 43032b564..4c33e5f1d 100644
--- a/src/plugins/aspell/weechat-aspell-config.c
+++ b/src/plugins/aspell/weechat-aspell-config.c
@@ -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);
}
diff --git a/src/plugins/aspell/weechat-aspell-speller.c b/src/plugins/aspell/weechat-aspell-speller.c
index 2dd7e2a0c..76fbb98af 100644
--- a/src/plugins/aspell/weechat-aspell-speller.c
+++ b/src/plugins/aspell/weechat-aspell-speller.c
@@ -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);
}
}
}
diff --git a/src/plugins/aspell/weechat-aspell.c b/src/plugins/aspell/weechat-aspell.c
index c476c685b..fc39fa52f 100644
--- a/src/plugins/aspell/weechat-aspell.c
+++ b/src/plugins/aspell/weechat-aspell.c
@@ -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);
}
}
}
diff --git a/src/plugins/demo/demo.c b/src/plugins/demo/demo.c
index 7bd1061dc..fe7abac61 100644
--- a/src/plugins/demo/demo.c
+++ b/src/plugins/demo/demo.c
@@ -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++;
}
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index 7833e686f..3199fc05c 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -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;
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index fe3679a94..dc871a54b 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -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);
}
}
diff --git a/src/plugins/irc/irc-mode.c b/src/plugins/irc/irc-mode.c
index 453c72143..4351a4368 100644
--- a/src/plugins/irc/irc-mode.c
+++ b/src/plugins/irc/irc-mode.c
@@ -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");
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 3ce69fc34..d27b720b2 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -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);
}
}
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 774dc8cfc..5915f47bf 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -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
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index 23ec2f30c..a0445fec2 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -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) */
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 1299e77c9..6f4ea07b6 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -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;
diff --git a/src/plugins/relay/relay-client.c b/src/plugins/relay/relay-client.c
index aa465b088..39dc7f6c5 100644
--- a/src/plugins/relay/relay-client.c
+++ b/src/plugins/relay/relay-client.c
@@ -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);
}
}
}
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index 2143fbfdc..6669427c8 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -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");
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index baf1c428e..cfe30e4b5 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -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");
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index b5919c97f..303411533 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -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");
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index e7f49d004..5eb325a1f 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -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");
diff --git a/src/plugins/scripts/script.c b/src/plugins/scripts/script.c
index 6837b888a..23286e76d 100644
--- a/src/plugins/scripts/script.c
+++ b/src/plugins/scripts/script.c
@@ -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;
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c
index 202710276..6ec6742c2 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -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");
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index 4de2335d7..0dab3ac81 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -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) \