From 49f30287648d9593d39bd967d8c8719ecefe765c Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Thu, 4 Mar 2010 10:15:21 +0000 Subject: [PATCH] Minor optimization of help file conversion. Signed-off-by: Andrew Borodin --- src/help.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/help.c b/src/help.c index ab0f4b0ab..75b53ab6b 100644 --- a/src/help.c +++ b/src/help.c @@ -835,7 +835,8 @@ translate_file (char *filedata) GIConv conv; GString *translated_data; - translated_data = g_string_new (""); + /* initial allocation for largest whole help file */ + translated_data = g_string_sized_new (32 * 1024); conv = str_crt_conv_from ("UTF-8"); @@ -844,10 +845,9 @@ translate_file (char *filedata) else { g_free (fdata); - if (str_convert (conv, filedata, translated_data) != ESTR_FAILURE) { - fdata = translated_data->str; - g_string_free (translated_data, FALSE); - } else { + if (str_convert (conv, filedata, translated_data) != ESTR_FAILURE) + fdata = g_string_free (translated_data, FALSE); + else { fdata = NULL; g_string_free (translated_data, TRUE); }