From 4df2f8129537081bd83f816e006b8ee8b98e7cc7 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 1 Oct 2019 13:25:03 +0200 Subject: [PATCH] tweaks: avoid recomputing a maximum value every time round the loop --- src/global.c | 3 ++- src/nano.h | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/global.c b/src/global.c index 53e85f24..def161b0 100644 --- a/src/global.c +++ b/src/global.c @@ -432,9 +432,10 @@ int the_code_for(void (*func)(void), int defaultval) size_t shown_entries_for(int menu) { funcstruct *item = allfuncs; + size_t maximum = ((COLS + 40) / 20) * 2; size_t count = 0; - while (count < MAIN_VISIBLE && item != NULL) { + while (count < maximum && item != NULL) { if (item->menus & menu) count++; item = item->next; diff --git a/src/nano.h b/src/nano.h index bc05a19c..f261c624 100644 --- a/src/nano.h +++ b/src/nano.h @@ -629,9 +629,6 @@ enum #define WAS_MARKED_FORWARD (1<<5) #endif /* !NANO_TINY */ -/* The maximum number of entries displayed in the main shortcut list. */ -#define MAIN_VISIBLE (((COLS + 40) / 20) * 2) - /* The default number of columns from end of line where wrapping occurs. */ #define COLUMNS_FROM_EOL 8