summaryrefslogtreecommitdiff
path: root/src/fe-text/statusbar-items.c
diff options
context:
space:
mode:
authorEmanuele Giaquinta <exg@irssi.org>2008-05-15 16:54:01 +0000
committerexg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564>2008-05-15 16:54:01 +0000
commit37b8c5564092b9ce1595cbe99e2049d43829ee04 (patch)
tree822fd4cc97b9dacd5741aa9e5e7a146bbca3fc1c /src/fe-text/statusbar-items.c
parentafd7bef7363cafeb0b6d4dbe27cdbaeab63ddbda (diff)
downloadirssi-37b8c5564092b9ce1595cbe99e2049d43829ee04.zip
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
Diffstat (limited to 'src/fe-text/statusbar-items.c')
-rw-r--r--src/fe-text/statusbar-items.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c
index e58781ef..201d17c7 100644
--- a/src/fe-text/statusbar-items.c
+++ b/src/fe-text/statusbar-items.c
@@ -73,11 +73,13 @@ static char *get_activity_list(MAIN_WINDOW_REC *window, int normal, int hilight)
{
THEME_REC *theme;
GString *str;
+ GString *format;
GList *tmp;
- char *ret, *name, *format, *value;
+ char *ret, *name, *value;
int is_det;
str = g_string_new(NULL);
+ format = g_string_new(NULL);
theme = window != NULL && window->active != 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)
- format = g_strdup_printf(name, window->refnum);
+ g_string_printf(format, name, window->refnum);
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->refnum);
- value = theme_format_expand(theme, format);
+ value = theme_format_expand(theme, format->str);
g_string_append(str, value);
g_free(value);
-
- g_free(format);
}
ret = str->len == 0 ? NULL : str->str;
g_string_free(str, ret == NULL);
+ g_string_free(format, TRUE);
return ret;
}