(search_content): reduce variable scope.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2024-05-18 19:34:48 +03:00
parent 44e4b7f8b9
commit 5dd087421e
1 changed files with 4 additions and 3 deletions

View File

@ -1047,9 +1047,6 @@ search_content (WDialog * h, const char *directory, const char *filename)
int n_read = 0;
off_t off = 0; /* file_fd's offset corresponding to strbuf[0] */
gboolean found = FALSE;
gsize found_len;
gsize found_start;
char result[BUF_MEDIUM];
char *strbuf = NULL; /* buffer for fetched string */
int strbuf_size = 0;
int i = -1; /* compensate for a newline we'll add when we first enter the loop */
@ -1067,6 +1064,7 @@ search_content (WDialog * h, const char *directory, const char *filename)
while (!ret_val)
{
char ch = '\0';
gsize found_len;
off += i + 1; /* the previous line, plus a newline character */
i = 0;
@ -1121,6 +1119,9 @@ search_content (WDialog * h, const char *directory, const char *filename)
if (!found /* Search in binary line once */
&& mc_search_run (search_content_handle, (const void *) strbuf, 0, i, &found_len))
{
gsize found_start;
char result[BUF_MEDIUM];
if (!status_updated)
{
/* if we add results for a file, we have to ensure that