mirror of
https://github.com/weechat/weechat.git
synced 2026-07-04 08:45:43 +02:00
Merge branch 'shared-strings'
This commit is contained in:
+249
-5
File diff suppressed because it is too large
Load Diff
@@ -59,8 +59,12 @@ extern int string_has_highlight_regex_compiled (const char *string,
|
||||
extern int string_has_highlight_regex (const char *string, const char *regex);
|
||||
extern char **string_split (const char *string, const char *separators,
|
||||
int keep_eol, int num_items_max, int *num_items);
|
||||
extern char **string_split_shared (const char *string, const char *separators,
|
||||
int keep_eol, int num_items_max,
|
||||
int *num_items);
|
||||
extern char **string_split_shell (const char *string);
|
||||
extern void string_free_split (char **split_string);
|
||||
extern void string_free_split_shared (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);
|
||||
@@ -84,5 +88,8 @@ extern char *string_replace_with_callback (const char *string,
|
||||
char *(*callback)(void *data, const char *text),
|
||||
void *callback_data,
|
||||
int *errors);
|
||||
extern const char *string_shared_get (const char *string);
|
||||
extern void string_shared_free (const char *string);
|
||||
extern void string_end ();
|
||||
|
||||
#endif /* __WEECHAT_STRING_H */
|
||||
|
||||
@@ -488,6 +488,7 @@ main (int argc, char *argv[])
|
||||
unhook_all (); /* remove all hooks */
|
||||
hdata_end (); /* end hdata */
|
||||
eval_end (); /* end eval */
|
||||
string_end (); /* end string */
|
||||
weechat_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?) */
|
||||
|
||||
return EXIT_SUCCESS; /* make C compiler happy */
|
||||
|
||||
+42
-28
File diff suppressed because it is too large
Load Diff
+20
-20
@@ -268,8 +268,8 @@ gui_nicklist_add_group (struct t_gui_buffer *buffer,
|
||||
if (!new_group)
|
||||
return NULL;
|
||||
|
||||
new_group->name = strdup (name);
|
||||
new_group->color = (color) ? strdup (color) : NULL;
|
||||
new_group->name = (char *)string_shared_get (name);
|
||||
new_group->color = (color) ? (char *)string_shared_get (color) : NULL;
|
||||
new_group->visible = visible;
|
||||
new_group->parent = (parent_group) ? parent_group : buffer->nicklist_root;
|
||||
new_group->level = (new_group->parent) ? new_group->parent->level + 1 : 0;
|
||||
@@ -442,10 +442,10 @@ gui_nicklist_add_nick (struct t_gui_buffer *buffer,
|
||||
return NULL;
|
||||
|
||||
new_nick->group = (group) ? group : buffer->nicklist_root;
|
||||
new_nick->name = strdup (name);
|
||||
new_nick->color = (color) ? strdup (color) : NULL;
|
||||
new_nick->prefix = (prefix) ? strdup (prefix) : NULL;
|
||||
new_nick->prefix_color = (prefix_color) ? strdup (prefix_color) : NULL;
|
||||
new_nick->name = (char *)string_shared_get (name);
|
||||
new_nick->color = (color) ? (char *)string_shared_get (color) : NULL;
|
||||
new_nick->prefix = (prefix) ? (char *)string_shared_get (prefix) : NULL;
|
||||
new_nick->prefix_color = (prefix_color) ? (char *)string_shared_get (prefix_color) : NULL;
|
||||
new_nick->visible = visible;
|
||||
|
||||
gui_nicklist_insert_nick_sorted (new_nick->group, new_nick);
|
||||
@@ -495,13 +495,13 @@ gui_nicklist_remove_nick (struct t_gui_buffer *buffer,
|
||||
|
||||
/* free data */
|
||||
if (nick->name)
|
||||
free (nick->name);
|
||||
string_shared_free (nick->name);
|
||||
if (nick->color)
|
||||
free (nick->color);
|
||||
string_shared_free (nick->color);
|
||||
if (nick->prefix)
|
||||
free (nick->prefix);
|
||||
string_shared_free (nick->prefix);
|
||||
if (nick->prefix_color)
|
||||
free (nick->prefix_color);
|
||||
string_shared_free (nick->prefix_color);
|
||||
|
||||
buffer->nicklist_count--;
|
||||
buffer->nicklist_nicks_count--;
|
||||
@@ -575,9 +575,9 @@ gui_nicklist_remove_group (struct t_gui_buffer *buffer,
|
||||
|
||||
/* free data */
|
||||
if (group->name)
|
||||
free (group->name);
|
||||
string_shared_free (group->name);
|
||||
if (group->color)
|
||||
free (group->color);
|
||||
string_shared_free (group->color);
|
||||
|
||||
if (group->visible)
|
||||
{
|
||||
@@ -884,8 +884,8 @@ gui_nicklist_group_set (struct t_gui_buffer *buffer,
|
||||
if (string_strcasecmp (property, "color") == 0)
|
||||
{
|
||||
if (group->color)
|
||||
free (group->color);
|
||||
group->color = (value[0]) ? strdup (value) : NULL;
|
||||
string_shared_free (group->color);
|
||||
group->color = (value[0]) ? (char *)string_shared_get (value) : NULL;
|
||||
group_changed = 1;
|
||||
}
|
||||
else if (string_strcasecmp (property, "visible") == 0)
|
||||
@@ -995,22 +995,22 @@ gui_nicklist_nick_set (struct t_gui_buffer *buffer,
|
||||
if (string_strcasecmp (property, "color") == 0)
|
||||
{
|
||||
if (nick->color)
|
||||
free (nick->color);
|
||||
nick->color = (value[0]) ? strdup (value) : NULL;
|
||||
string_shared_free (nick->color);
|
||||
nick->color = (value[0]) ? (char *)string_shared_get (value) : NULL;
|
||||
nick_changed = 1;
|
||||
}
|
||||
else if (string_strcasecmp (property, "prefix") == 0)
|
||||
{
|
||||
if (nick->prefix)
|
||||
free (nick->prefix);
|
||||
nick->prefix = (value[0]) ? strdup (value) : NULL;
|
||||
string_shared_free (nick->prefix);
|
||||
nick->prefix = (value[0]) ? (char *)string_shared_get (value) : NULL;
|
||||
nick_changed = 1;
|
||||
}
|
||||
else if (string_strcasecmp (property, "prefix_color") == 0)
|
||||
{
|
||||
if (nick->prefix_color)
|
||||
free (nick->prefix_color);
|
||||
nick->prefix_color = (value[0]) ? strdup (value) : NULL;
|
||||
string_shared_free (nick->prefix_color);
|
||||
nick->prefix_color = (value[0]) ? (char *)string_shared_get (value) : NULL;
|
||||
nick_changed = 1;
|
||||
}
|
||||
else if (string_strcasecmp (property, "visible") == 0)
|
||||
|
||||
Reference in New Issue
Block a user