diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2022-12-18 14:10:10 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2022-12-18 14:28:58 +0100 |
commit | 40339b288ac37ace539d9091e8a2878540f49273 (patch) | |
tree | 5570b3a5a48e8a4cee4daaa36bc002d93a392084 /src/gui | |
parent | eb6cc0bc2afa96824667521d3405bd1c077a4690 (diff) | |
download | weechat-40339b288ac37ace539d9091e8a2878540f49273.zip |
api: return newly allocated string in functions string_tolower and string_toupper
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui-completion.c | 8 | ||||
-rw-r--r-- | src/gui/gui-nick.c | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c index e2459a781..5e07861f1 100644 --- a/src/gui/gui-completion.c +++ b/src/gui/gui-completion.c @@ -1144,6 +1144,7 @@ gui_completion_complete (struct t_gui_completion *completion) int length, word_found_seen, other_completion, partial_completion; int common_prefix_size, index, index2; struct t_gui_completion_word *ptr_completion_word, *ptr_completion_word2; + char *word_found_lower; length = utf8_strlen (completion->base_word); word_found_seen = 0; @@ -1262,7 +1263,12 @@ gui_completion_complete (struct t_gui_completion *completion) completion->word_found_is_nick = 0; completion->add_space = 0; completion->position = -1; - string_tolower (completion->word_found); + word_found_lower = string_tolower (completion->word_found); + if (word_found_lower) + { + free (completion->word_found); + completion->word_found = word_found_lower; + } /* alert user of partial completion */ if (CONFIG_BOOLEAN(config_completion_partial_completion_alert)) diff --git a/src/gui/gui-nick.c b/src/gui/gui-nick.c index d6fcfc982..9953194bc 100644 --- a/src/gui/gui-nick.c +++ b/src/gui/gui-nick.c @@ -182,10 +182,9 @@ gui_nick_get_forced_color (const char *nickname) if (forced_color) return forced_color; - nick_lower = strdup (nickname); + nick_lower = string_tolower (nickname); if (nick_lower) { - string_tolower (nick_lower); forced_color = hashtable_get (config_hashtable_nick_color_force, nick_lower); free (nick_lower); |