mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-24 20:22:11 +03:00
(expand_format): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
53b146c83a
commit
4bd81f5866
@ -869,32 +869,31 @@ expand_format (struct WEdit *edit_widget, char c, gboolean do_quote)
|
||||
case 't':
|
||||
case 'u':
|
||||
{
|
||||
int length = 2, i;
|
||||
char *block, *tmp;
|
||||
GString *block;
|
||||
int i;
|
||||
|
||||
if (!panel)
|
||||
if (panel == NULL)
|
||||
{
|
||||
result = g_strdup ("");
|
||||
goto ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < panel->count; i++)
|
||||
if (panel->dir.list[i].f.marked)
|
||||
length += strlen (panel->dir.list[i].fname) + 1; /* for space */
|
||||
block = g_string_sized_new (16);
|
||||
|
||||
block = g_malloc (length * 2 + 1);
|
||||
*block = 0;
|
||||
for (i = 0; i < panel->count; i++)
|
||||
if (panel->dir.list[i].f.marked)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
tmp = (*quote_func) (panel->dir.list[i].fname, 0);
|
||||
strcat (block, tmp);
|
||||
g_string_append (block, tmp);
|
||||
g_string_append_c (block, ' ');
|
||||
g_free (tmp);
|
||||
strcat (block, " ");
|
||||
|
||||
if (c_lc == 'u')
|
||||
do_file_mark (panel, i, 0);
|
||||
}
|
||||
result = block;
|
||||
result = g_string_free (block, FALSE);
|
||||
goto ret;
|
||||
} /* sub case block */
|
||||
} /* switch */
|
||||
|
Loading…
Reference in New Issue
Block a user