Minor optimization of help file conversion.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2010-03-04 10:15:21 +00:00
parent 8cb8c7efa9
commit 49f3028764

View File

@ -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);
}