From 73b3764bb5ea8a78f8cebec6f1e8cc4bb03d5751 Mon Sep 17 00:00:00 2001 From: Federico Kircheis Date: Wed, 7 Mar 2018 18:24:25 +0100 Subject: [PATCH] Reduce variable scope - sidebar.c --- sidebar.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/sidebar.c b/sidebar.c index 4d4feafb6..0c0e8e3da 100644 --- a/sidebar.c +++ b/sidebar.c @@ -398,19 +398,18 @@ static void update_entries_visibility(void) static void unsort_entries(void) { struct Buffy *cur = Incoming; - int i = 0, j; - struct SbEntry *tmp = NULL; + int i = 0; while (cur && (i < EntryCount)) { - j = i; + int j = i; while ((j < EntryCount) && (Entries[j]->buffy != cur)) j++; if (j < EntryCount) { if (j != i) { - tmp = Entries[i]; + struct SbEntry *tmp = Entries[i]; Entries[i] = Entries[j]; Entries[j] = tmp; } @@ -607,7 +606,6 @@ static int select_page_up(void) static bool prepare_sidebar(int page_size) { struct SbEntry *opn_entry = NULL, *hil_entry = NULL; - int page_entries; if (!EntryCount || (page_size <= 0)) return false; @@ -650,7 +648,7 @@ static bool prepare_sidebar(int page_size) while (BotIndex < HilIndex) { TopIndex = BotIndex + 1; - page_entries = 0; + int page_entries = 0; while (page_entries < page_size) { BotIndex++; @@ -1128,8 +1126,6 @@ void mutt_sb_set_open_buffy(void) */ void mutt_sb_notify_mailbox(struct Buffy *b, int created) { - int del_index; - if (!b) return; @@ -1157,6 +1153,7 @@ void mutt_sb_notify_mailbox(struct Buffy *b, int created) } else { + int del_index; for (del_index = 0; del_index < EntryCount; del_index++) if (Entries[del_index]->buffy == b) break; -- 2.40.0