1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 23:06:38 +02:00

core: replace argument "keep_eol" by "flags" in function string_split (closes #1322)

This commit is contained in:
Sébastien Helleu
2019-03-10 13:16:59 +01:00
parent 8aa5f5375e
commit 2b70d71aa1
77 changed files with 1389 additions and 341 deletions
+32 -5
View File
@@ -832,7 +832,11 @@ script_action_show_diff_process_cb (const void *pointer, void *data,
{
if (out)
{
lines = weechat_string_split (out, "\n", 0, 0, &num_lines);
lines = weechat_string_split (out, "\n",
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &num_lines);
if (lines)
{
diff_color = weechat_config_boolean (script_config_look_diff_color);
@@ -867,7 +871,11 @@ script_action_show_diff_process_cb (const void *pointer, void *data,
}
else if (err)
{
lines = weechat_string_split (err, "\n", 0, 0, &num_lines);
lines = weechat_string_split (err, "\n",
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &num_lines);
if (lines)
{
for (i = 0; i < num_lines; i++)
@@ -1173,7 +1181,11 @@ script_action_run ()
script_get_loaded_plugins ();
actions = weechat_string_split (script_actions, "\n", 0, 0, &num_actions);
actions = weechat_string_split (script_actions, "\n",
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &num_actions);
if (actions)
{
for (i = 0; i < num_actions; i++)
@@ -1202,8 +1214,23 @@ script_action_run ()
ptr_action++;
}
}
argv = weechat_string_split (ptr_action, " ", 0, 0, &argc);
argv_eol = weechat_string_split (ptr_action, " ", 1, 0, &argc);
argv = weechat_string_split (
ptr_action,
" ",
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0,
&argc);
argv_eol = weechat_string_split (
ptr_action,
" ",
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
| WEECHAT_STRING_SPLIT_KEEP_EOL,
0,
&argc);
if (argv && argv_eol)
{
if (weechat_strcasecmp (argv[0], "buffer") == 0)
+8 -2
View File
@@ -256,8 +256,14 @@ script_completion_tags_cb (const void *pointer, void *data,
{
if (ptr_script->tags)
{
list_tags = weechat_string_split (ptr_script->tags, ",", 0, 0,
&num_tags);
list_tags = weechat_string_split (
ptr_script->tags,
",",
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0,
&num_tags);
if (list_tags)
{
for (i = 0; i < num_tags; i++)
+21 -5
View File
@@ -113,7 +113,11 @@ script_config_get_diff_command ()
result[0] = '\0';
if (dir_separator && path)
{
paths = weechat_string_split (path, ":", 0, 0, &num_paths);
paths = weechat_string_split (path, ":",
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &num_paths);
if (paths)
{
for (i = 0; i < num_paths; i++)
@@ -289,8 +293,14 @@ script_config_hold (const char *name_with_extension)
if (hold)
{
hold[0] = '\0';
items = weechat_string_split (weechat_config_string (script_config_scripts_hold),
",", 0, 0, &num_items);
items = weechat_string_split (
weechat_config_string (script_config_scripts_hold),
",",
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0,
&num_items);
if (items)
{
for (i = 0; i < num_items; i++)
@@ -332,8 +342,14 @@ script_config_unhold (const char *name_with_extension)
if (hold)
{
hold[0] = '\0';
items = weechat_string_split (weechat_config_string (script_config_scripts_hold),
",", 0, 0, &num_items);
items = weechat_string_split (
weechat_config_string (script_config_scripts_hold),
",",
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0,
&num_items);
if (items)
{
for (i = 0; i < num_items; i++)
+10 -3
View File
@@ -934,9 +934,16 @@ script_repo_match_filter (struct t_script_repo *script)
if (!script_repo_filter || strcmp (script_repo_filter, "*") == 0)
return 1;
words = weechat_string_split (script_repo_filter, " ", 0, 0, &num_words);
tags = weechat_string_split ((script->tags) ? script->tags : "", ",", 0, 0,
&num_tags);
words = weechat_string_split (script_repo_filter, " ",
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &num_words);
tags = weechat_string_split ((script->tags) ? script->tags : "", ",",
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &num_tags);
if (words)
{
for (i = 0; i < num_words; i++)