(mcview_do_search): cleanup variables.

This commit is contained in:
Andrew Borodin 2015-11-09 12:48:02 +03:00
parent d3a2ca3e12
commit 5d76c8e2c2

View File

@ -268,8 +268,7 @@ mcview_do_search (WView * view, off_t want_search_start)
off_t search_start = 0;
off_t orig_search_start = view->search_start;
gboolean isFound = FALSE;
gboolean need_search_again = TRUE;
gboolean found = FALSE;
size_t match_len;
@ -331,8 +330,7 @@ mcview_do_search (WView * view, off_t want_search_start)
if (mcview_find (&vsm, search_start, mcview_get_filesize (view), &match_len))
{
mcview_search_show_result (view, match_len);
need_search_again = FALSE;
isFound = TRUE;
found = TRUE;
break;
}
@ -350,20 +348,15 @@ mcview_do_search (WView * view, off_t want_search_start)
status_msg_deinit (STATUS_MSG (&vsm));
if (orig_search_start != 0 && !isFound && need_search_again
&& !mcview_search_options.backwards)
if (orig_search_start != 0 && !found && !mcview_search_options.backwards)
{
int result;
view->search_start = orig_search_start;
mcview_update (view);
result =
query_dialog (_("Search done"), _("Continue from beginning?"), D_NORMAL, 2, _("&Yes"),
_("&No"));
if (result != 0)
isFound = TRUE;
if (query_dialog
(_("Search done"), _("Continue from beginning?"), D_NORMAL, 2, _("&Yes"),
_("&No")) != 0)
found = TRUE;
else
{
/* continue search from beginning */
@ -383,14 +376,14 @@ mcview_do_search (WView * view, off_t want_search_start)
if (mcview_find (&vsm, search_start, search_end, &match_len))
{
mcview_search_show_result (view, match_len);
isFound = TRUE;
found = TRUE;
}
status_msg_deinit (STATUS_MSG (&vsm));
}
}
if (!isFound && view->search->error_str != NULL)
if (!found && view->search->error_str != NULL)
{
view->search_start = orig_search_start;
mcview_update (view);