Ticket #2545: optimization of history saving.

(hist_next): get rid of direct access to the next histroy item.
(history_show): remove redundant check.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2011-06-30 21:49:17 +04:00
parent f3ae923a6d
commit 166281c39a
2 changed files with 7 additions and 5 deletions

View File

@ -394,8 +394,7 @@ history_show (GList ** history, Widget * widget)
char *q;
listbox_get_current (query_list, &q, NULL);
if (q != NULL)
r = g_strdup (q);
r = g_strdup (q);
}
/* get modified history from dialog */

View File

@ -593,6 +593,8 @@ hist_prev (WInput * in)
static void
hist_next (WInput * in)
{
GList *next;
if (in->need_push)
{
push_history (in, in->buffer);
@ -603,12 +605,13 @@ hist_next (WInput * in)
if (in->history == NULL)
return;
if (in->history->next == NULL)
next = g_list_next (in->history);
if (next == NULL)
input_assign_text (in, "");
else
{
in->history = g_list_next (in->history);
input_assign_text (in, (char *) in->history->data);
in->history = next;
input_assign_text (in, (char *) next->data);
in->need_push = FALSE;
}
}