Minor optimization of memory allocation for string copy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
49dd358a16
Коммит
b3d1eafb5e
@ -1468,7 +1468,6 @@ get_random_hint (int force)
|
||||
static int last_sec;
|
||||
static struct timeval tv;
|
||||
GIConv conv;
|
||||
GString *buffer;
|
||||
|
||||
/* Do not change hints more often than one minute */
|
||||
gettimeofday (&tv, NULL);
|
||||
@ -1501,10 +1500,13 @@ get_random_hint (int force)
|
||||
conv = str_crt_conv_from ("UTF-8");
|
||||
if (conv != INVALID_CONV)
|
||||
{
|
||||
GString *buffer;
|
||||
|
||||
buffer = g_string_new ("");
|
||||
if (str_convert (conv, &data[start], buffer) != ESTR_FAILURE)
|
||||
result = g_strdup (buffer->str);
|
||||
g_string_free (buffer, TRUE);
|
||||
result = g_string_free (buffer, FALSE);
|
||||
else
|
||||
g_string_free (buffer, TRUE);
|
||||
str_close_conv (conv);
|
||||
}
|
||||
|
||||
|
@ -590,7 +590,6 @@ load_panelize (void)
|
||||
gchar **profile_keys, **keys;
|
||||
gsize len;
|
||||
GIConv conv;
|
||||
GString *buffer;
|
||||
|
||||
conv = str_crt_conv_from ("UTF-8");
|
||||
|
||||
@ -612,25 +611,22 @@ load_panelize (void)
|
||||
|
||||
while (*profile_keys)
|
||||
{
|
||||
GString *buffer;
|
||||
|
||||
if (mc_global.utf8_display || conv == INVALID_CONV)
|
||||
{
|
||||
buffer = g_string_new (*profile_keys);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer = g_string_new ("");
|
||||
if (str_convert (conv, *profile_keys, buffer) == ESTR_FAILURE)
|
||||
{
|
||||
g_string_free (buffer, TRUE);
|
||||
buffer = g_string_new (*profile_keys);
|
||||
}
|
||||
g_string_assign (buffer, *profile_keys);
|
||||
}
|
||||
|
||||
add2panelize (g_string_free (buffer, FALSE),
|
||||
mc_config_get_string (mc_main_config, panelize_section, *profile_keys, ""));
|
||||
profile_keys++;
|
||||
}
|
||||
|
||||
g_strfreev (keys);
|
||||
str_close_conv (conv);
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user