commit 31d5cb1118ed4574b50be7eab71f5eec685bd9fb
parent f551c07e7ac91e7b828629e7aa5a16989fb5abd1
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 13 Oct 2019 18:51:15 +0200
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.)
Diffstat:
5 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/src/browser.c b/src/browser.c
@@ -21,13 +21,13 @@
#include "proto.h"
+#ifdef ENABLE_BROWSER
+
#include <errno.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
-#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
@@ -21,14 +21,14 @@
#include "proto.h"
+#ifdef ENABLE_COLOR
+
#include <errno.h>
#ifdef HAVE_MAGIC_H
#include <magic.h>
#endif
#include <string.h>
-#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
@@ -22,11 +22,11 @@
#include "proto.h"
+#ifdef ENABLE_HELP
+
#include <errno.h>
#include <string.h>
-#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
@@ -21,11 +21,11 @@
#include "proto.h"
+#ifdef ENABLE_HISTORIES
+
#include <errno.h>
#include <string.h>
-#ifdef ENABLE_HISTORIES
-
#ifndef SEARCH_HISTORY
#define SEARCH_HISTORY "search_history"
#endif
diff --git a/src/rcfile.c b/src/rcfile.c
@@ -23,14 +23,14 @@
#include "proto.h"
+#ifdef ENABLE_NANORC
+
#include <ctype.h>
#include <errno.h>
#include <glob.h>
#include <string.h>
#include <unistd.h>
-#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);