1
0
mirror of https://github.com/irssi/irssi.git synced 2025-01-03 14:56:47 -05:00

Use a GString rather than g_strdup_printf to build the format string.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4826 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Emanuele Giaquinta 2008-05-15 16:54:01 +00:00 committed by exg
parent afd7bef736
commit 37b8c55640

View File

@ -73,11 +73,13 @@ static char *get_activity_list(MAIN_WINDOW_REC *window, int normal, int hilight)
{ {
THEME_REC *theme; THEME_REC *theme;
GString *str; GString *str;
GString *format;
GList *tmp; GList *tmp;
char *ret, *name, *format, *value; char *ret, *name, *value;
int is_det; int is_det;
str = g_string_new(NULL); str = g_string_new(NULL);
format = g_string_new(NULL);
theme = window != NULL && window->active != NULL && theme = window != NULL && window->active != NULL &&
window->active->theme != NULL ? window->active->theme != NULL ?
@ -114,21 +116,20 @@ static char *get_activity_list(MAIN_WINDOW_REC *window, int normal, int hilight)
} }
if (name != NULL) if (name != NULL)
format = g_strdup_printf(name, window->refnum); g_string_printf(format, name, window->refnum);
else else
format = g_strdup_printf("{sb_act_hilight_color %s %d}", g_string_printf(format, "{sb_act_hilight_color %s %d}",
window->hilight_color, window->hilight_color,
window->refnum); window->refnum);
value = theme_format_expand(theme, format); value = theme_format_expand(theme, format->str);
g_string_append(str, value); g_string_append(str, value);
g_free(value); g_free(value);
g_free(format);
} }
ret = str->len == 0 ? NULL : str->str; ret = str->len == 0 ? NULL : str->str;
g_string_free(str, ret == NULL); g_string_free(str, ret == NULL);
g_string_free(format, TRUE);
return ret; return ret;
} }