From 31d5cb1118ed4574b50be7eab71f5eec685bd9fb Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 13 Oct 2019 18:51:15 +0200 Subject: [PATCH] build: slightly speed up the compilation of the tiny version Don't include header files when they won't actually be needed. (Also, remove a superfluous #ifdef.) --- src/browser.c | 4 ++-- src/color.c | 4 ++-- src/help.c | 4 ++-- src/history.c | 4 ++-- src/rcfile.c | 7 +++---- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/browser.c b/src/browser.c index a4e7882d..ed2b04d8 100644 --- a/src/browser.c +++ b/src/browser.c @@ -21,13 +21,13 @@ #include "proto.h" +#ifdef ENABLE_BROWSER + #include #include #include #include -#ifdef ENABLE_BROWSER - static char **filelist = NULL; /* The list of files to display in the file browser. */ static size_t filelist_len = 0; diff --git a/src/color.c b/src/color.c index 188ded08..dafaea5f 100644 --- a/src/color.c +++ b/src/color.c @@ -21,14 +21,14 @@ #include "proto.h" +#ifdef ENABLE_COLOR + #include #ifdef HAVE_MAGIC_H #include #endif #include -#ifdef ENABLE_COLOR - /* For early versions of ncurses-6.0, use an additional A_PROTECT attribute * for all colors, in order to work around an ncurses miscoloring bug. */ #if defined(NCURSES_VERSION_MAJOR) && (NCURSES_VERSION_MAJOR == 6) && \ diff --git a/src/help.c b/src/help.c index 6c16da5c..6a717798 100644 --- a/src/help.c +++ b/src/help.c @@ -22,11 +22,11 @@ #include "proto.h" +#ifdef ENABLE_HELP + #include #include -#ifdef ENABLE_HELP - static char *help_text = NULL; /* The text displayed in the help window. */ diff --git a/src/history.c b/src/history.c index f92176c1..ac936b45 100644 --- a/src/history.c +++ b/src/history.c @@ -21,11 +21,11 @@ #include "proto.h" +#ifdef ENABLE_HISTORIES + #include #include -#ifdef ENABLE_HISTORIES - #ifndef SEARCH_HISTORY #define SEARCH_HISTORY "search_history" #endif diff --git a/src/rcfile.c b/src/rcfile.c index 5f2c01fe..2251e313 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -23,14 +23,14 @@ #include "proto.h" +#ifdef ENABLE_NANORC + #include #include #include #include #include -#ifdef ENABLE_NANORC - #ifndef RCFILE_NAME #define HOME_RC_NAME ".nanorc" #define RCFILE_NAME "nanorc" @@ -501,11 +501,10 @@ void parse_binding(char *ptr, bool dobind) if (newsc->func == do_toggle_void) mask = MMAIN; #endif -#ifdef ENABLE_NANORC /* Handle the special case of a key defined as a string. */ if (newsc->func == (functionptrtype)implant) mask = MMOST | MHELP; -#endif + /* Now limit the given menu to those where the function exists. */ menu = menu & (is_universal(newsc->func) ? MMOST : mask);