Rename function string_explode to string_split
parent
4a89b4ae59
commit
2f7a5a4147
|
@ -761,24 +761,24 @@ char *str_regex = weechat_string_mask_to_regex ("test*mask");
|
|||
free (str_regex);
|
||||
----------------------------------------
|
||||
|
||||
weechat_string_explode
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
weechat_string_split
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Explode a string according to one or more delimiter(s).
|
||||
Split a string according to one or more delimiter(s).
|
||||
|
||||
Prototype:
|
||||
|
||||
[source,C]
|
||||
----------------------------------------
|
||||
char **weechat_string_explode (const char *string, const char *separators,
|
||||
int keep_eol, int num_items_max,
|
||||
int *num_items);
|
||||
char **weechat_string_split (const char *string, const char *separators,
|
||||
int keep_eol, int num_items_max,
|
||||
int *num_items);
|
||||
----------------------------------------
|
||||
|
||||
Arguments:
|
||||
|
||||
* 'string': string to explode
|
||||
* 'separators': delimiters used for explosion
|
||||
* 'string': string to split
|
||||
* 'separators': delimiters used for split
|
||||
* 'keep_eol': if different from 0, then each argument will contain all string
|
||||
until end of line (see example below)
|
||||
* 'num_items_max': maximum number of items created (0 = no limit)
|
||||
|
@ -787,7 +787,7 @@ Arguments:
|
|||
Return value:
|
||||
|
||||
* array of strings, NULL if problem (must be freed by calling
|
||||
<<_weechat_string_free_exploded>> after use)
|
||||
<<_weechat_string_free_split>> after use)
|
||||
|
||||
Examples:
|
||||
|
||||
|
@ -795,40 +795,40 @@ Examples:
|
|||
----------------------------------------
|
||||
char **argv;
|
||||
int argc;
|
||||
argv = weechat_string_explode ("abc de fghi", " ", 0, 0, &argc);
|
||||
argv = weechat_string_split ("abc de fghi", " ", 0, 0, &argc);
|
||||
/* result: argv[0] == "abc"
|
||||
argv[1] == "de"
|
||||
argv[2] == "fghi"
|
||||
argv[3] == NULL
|
||||
argc == 3
|
||||
*/
|
||||
weechat_string_free_exploded (argv);
|
||||
weechat_string_free_split (argv);
|
||||
|
||||
argv = weechat_string_explode ("abc de fghi", " ", 1, 0, &argc);
|
||||
argv = weechat_string_split ("abc de fghi", " ", 1, 0, &argc);
|
||||
/* result: argv[0] == "abc de fghi"
|
||||
argv[1] == "de fghi"
|
||||
argv[2] == "fghi"
|
||||
argv[3] == NULL
|
||||
argc == 3
|
||||
*/
|
||||
weechat_string_free_exploded (argv);
|
||||
weechat_string_free_split (argv);
|
||||
----------------------------------------
|
||||
|
||||
weechat_string_free_exploded
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
weechat_string_free_split
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Free memory used by a string explosion.
|
||||
Free memory used by a split string.
|
||||
|
||||
Prototype:
|
||||
|
||||
[source,C]
|
||||
----------------------------------------
|
||||
void weechat_string_free_exploded (char **exploded_string);
|
||||
void weechat_string_free_split (char **split_string);
|
||||
----------------------------------------
|
||||
|
||||
Arguments:
|
||||
|
||||
* 'exploded_string': string exploded by function <<_weechat_string_explode>>
|
||||
* 'split_string': string split by function <<_weechat_string_split>>
|
||||
|
||||
Example:
|
||||
|
||||
|
@ -836,32 +836,32 @@ Example:
|
|||
----------------------------------------
|
||||
char *argv;
|
||||
int argc;
|
||||
argv = weechat_string_explode (string, " ", 0, 0, &argc);
|
||||
argv = weechat_string_split (string, " ", 0, 0, &argc);
|
||||
/* ... */
|
||||
weechat_string_free_exploded (argv);
|
||||
weechat_string_free_split (argv);
|
||||
----------------------------------------
|
||||
|
||||
weechat_string_build_with_exploded
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
weechat_string_build_with_split_string
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Build a string with exploded string.
|
||||
Build a string with a split string.
|
||||
|
||||
Prototype:
|
||||
|
||||
[source,C]
|
||||
----------------------------------------
|
||||
char *weechat_string_build_with_exploded (char **exploded_string,
|
||||
const char *separator);
|
||||
char *weechat_string_build_with_split_string (char **split_string,
|
||||
const char *separator);
|
||||
----------------------------------------
|
||||
|
||||
Arguments:
|
||||
|
||||
* 'exploded_string': string exploded by function <<_weechat_string_explode>>
|
||||
* 'split_string': string split by function <<_weechat_string_split>>
|
||||
* 'separator': string used to separate strings
|
||||
|
||||
Return value:
|
||||
|
||||
* string built with exploded string (must be freed by calling "free" after use)
|
||||
* string built with split string (must be freed by calling "free" after use)
|
||||
|
||||
Example:
|
||||
|
||||
|
@ -869,8 +869,8 @@ Example:
|
|||
----------------------------------------
|
||||
char **argv;
|
||||
int argc;
|
||||
argv = weechat_string_explode ("abc def ghi", " ", 0, 0, &argc);
|
||||
char *str = weechat_string_build_with_exploded (argv, ";");
|
||||
argv = weechat_string_split ("abc def ghi", " ", 0, 0, &argc);
|
||||
char *str = weechat_string_build_with_split_string (argv, ";");
|
||||
/* str == "abc;def;ghi" */
|
||||
/* ... */
|
||||
free (str);
|
||||
|
|
|
@ -44,7 +44,7 @@ Pre-requisites
|
|||
In order to install WeeChat, you need:
|
||||
|
||||
* a running GNU/Linux system (with compiler tools for source
|
||||
package), or compatible OS (see above)
|
||||
package), or compatible OS
|
||||
* 'root' privileges (to install WeeChat in a system directory)
|
||||
* ncurses library
|
||||
|
||||
|
|
|
@ -770,24 +770,24 @@ char *str_regex = weechat_string_mask_to_regex ("test*mask");
|
|||
free (str_regex);
|
||||
----------------------------------------
|
||||
|
||||
weechat_string_explode
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
weechat_string_split
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Explosion d'une chaîne à l'aide de délimiteur(s).
|
||||
Découpe une chaîne à l'aide de délimiteur(s).
|
||||
|
||||
Prototype :
|
||||
|
||||
[source,C]
|
||||
----------------------------------------
|
||||
char **weechat_string_explode (const char *string, const char *separators,
|
||||
int keep_eol, int num_items_max,
|
||||
int *num_items);
|
||||
char **weechat_string_split (const char *string, const char *separators,
|
||||
int keep_eol, int num_items_max,
|
||||
int *num_items);
|
||||
----------------------------------------
|
||||
|
||||
Paramètres :
|
||||
|
||||
* 'string' : chaîne à exploser
|
||||
* 'separators' : délimiteurs utilisés pour l'explosion
|
||||
* 'string' : chaîne à découper
|
||||
* 'separators' : délimiteurs utilisés pour le découpage
|
||||
* 'keep_eol' : si différent de 0, alors chaque argument contiendra toutes les
|
||||
chaînes jusqu'à la fin de la ligne (voir exemple ci-dessous)
|
||||
* 'num_items_max' : nombre maximum de chaînes à créer (0 = pas de limite)
|
||||
|
@ -797,7 +797,7 @@ Paramètres :
|
|||
Valeur de retour :
|
||||
|
||||
* tableau de chaînes, NULL en cas de problème (doit être libéré par un appel à
|
||||
<<_weechat_string_free_exploded>> après utilisation)
|
||||
<<_weechat_string_free_split>> après utilisation)
|
||||
|
||||
Exemples :
|
||||
|
||||
|
@ -805,40 +805,40 @@ Exemples :
|
|||
----------------------------------------
|
||||
char **argv;
|
||||
int argc;
|
||||
argv = weechat_string_explode ("abc de fghi", " ", 0, 0, &argc);
|
||||
argv = weechat_string_split ("abc de fghi", " ", 0, 0, &argc);
|
||||
/* résultat : argv[0] == "abc"
|
||||
argv[1] == "de"
|
||||
argv[2] == "fghi"
|
||||
argv[3] == NULL
|
||||
argc == 3
|
||||
*/
|
||||
weechat_string_free_exploded (argv);
|
||||
weechat_string_free_split (argv);
|
||||
|
||||
argv = weechat_string_explode ("abc de fghi", " ", 1, 0, &argc);
|
||||
argv = weechat_string_split ("abc de fghi", " ", 1, 0, &argc);
|
||||
/* résultat : argv[0] == "abc de fghi"
|
||||
argv[1] == "de fghi"
|
||||
argv[2] == "fghi"
|
||||
argv[3] == NULL
|
||||
argc == 3
|
||||
*/
|
||||
weechat_string_free_exploded (argv);
|
||||
weechat_string_free_split (argv);
|
||||
----------------------------------------
|
||||
|
||||
weechat_string_free_exploded
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
weechat_string_free_split
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Libère la mémoire utilisée pour l'explosion d'une chaîne.
|
||||
Libère la mémoire utilisée pour le découpage d'une chaîne.
|
||||
|
||||
Prototype :
|
||||
|
||||
[source,C]
|
||||
----------------------------------------
|
||||
void weechat_string_free_exploded (char **exploded_string);
|
||||
void weechat_string_free_split (char **split_string);
|
||||
----------------------------------------
|
||||
|
||||
Paramètres :
|
||||
|
||||
* 'exploded_string' : chaîne explosée par <<_weechat_string_explode>>
|
||||
* 'split_string' : chaîne découpée par <<_weechat_string_split>>
|
||||
|
||||
Exemple :
|
||||
|
||||
|
@ -846,32 +846,32 @@ Exemple :
|
|||
----------------------------------------
|
||||
char *argv;
|
||||
int argc;
|
||||
argv = weechat_string_explode (string, " ", 0, 0, &argc);
|
||||
argv = weechat_string_split (string, " ", 0, 0, &argc);
|
||||
/* ... */
|
||||
weechat_string_free_exploded (argv);
|
||||
weechat_string_free_split (argv);
|
||||
----------------------------------------
|
||||
|
||||
weechat_string_build_with_exploded
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
weechat_string_build_with_split_string
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Construit une chaîne à partir d'une chaîne explosée.
|
||||
Construit une chaîne à partir d'une chaîne découpée.
|
||||
|
||||
Prototype :
|
||||
|
||||
[source,C]
|
||||
----------------------------------------
|
||||
char *weechat_string_build_with_exploded (char **exploded_string,
|
||||
const char *separator);
|
||||
char *weechat_string_build_with_split_string (char **split_string
|
||||
const char *separator);
|
||||
----------------------------------------
|
||||
|
||||
Paramètres :
|
||||
|
||||
* 'exploded_string' : chaîne explosée par la fonction <<_weechat_string_explode>>
|
||||
* 'split_string' : chaîne découpée par la fonction <<_weechat_string_split>>
|
||||
* 'separator' : chaîne utilisée pour séparer les différentes chaînes
|
||||
|
||||
Valeur de retour :
|
||||
|
||||
* chaîne construite avec la chaîne explosée (doit être libérée par un appel à
|
||||
* chaîne construite avec la chaîne découpée (doit être libérée par un appel à
|
||||
"free" après utilisation)
|
||||
|
||||
Exemple :
|
||||
|
@ -880,8 +880,8 @@ Exemple :
|
|||
----------------------------------------
|
||||
char **argv;
|
||||
int argc;
|
||||
argv = weechat_string_explode ("abc def ghi", " ", 0, 0, &argc);
|
||||
char *str = weechat_string_build_with_exploded (argv, ";");
|
||||
argv = weechat_string_split ("abc def ghi", " ", 0, 0, &argc);
|
||||
char *str = weechat_string_build_with_split_string (argv, ";");
|
||||
/* str == "abc;def;ghi" */
|
||||
/* ... */
|
||||
free (str);
|
||||
|
|
|
@ -45,7 +45,7 @@ Pré-requis
|
|||
Pour installer WeeChat, vous devez avoir :
|
||||
|
||||
* un système GNU/Linux (avec le compilateur et les outils associés pour le
|
||||
paquet des sources), ou un système compatible (voir ci-dessus)
|
||||
paquet des sources), ou un système compatible
|
||||
* droits "root" (pour installer WeeChat dans un répertoire système)
|
||||
* la bibliothèque ncurses
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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? */
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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) \
|
||||
|
|
Loading…
Reference in New Issue