From f4d1ef1c4e9adc89891594de54218dd63e43b1d1 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 21 Mar 2018 11:40:15 +0100 Subject: [PATCH] tweaks: remove unneeded settings and unsettings of MULTIBUFFER In the preceding commit, open_buffer() was changed so that it gets told whether to load into a new buffer or not, so it is no longer needed to convey this information through a flag. --- src/help.c | 1 - src/nano.c | 21 +++++++-------------- src/text.c | 1 - 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/help.c b/src/help.c index 0407a80a..b95fe559 100644 --- a/src/help.c +++ b/src/help.c @@ -142,7 +142,6 @@ void do_help(void) UNSET(WHITESPACE_DISPLAY); UNSET(NOREAD_MODE); - SET(MULTIBUFFER); #ifdef ENABLE_LINENUMBERS UNSET(LINE_NUMBERS); diff --git a/src/nano.c b/src/nano.c index 93a99b8a..9db58f07 100644 --- a/src/nano.c +++ b/src/nano.c @@ -42,6 +42,12 @@ #include #endif +#ifdef ENABLE_MULTIBUFFER +#define read_them_all TRUE +#else +#define read_them_all FALSE +#endif + #ifdef ENABLE_MOUSE static int oldinterval = -1; /* Used to store the user's original mouse click interval. */ @@ -1942,11 +1948,6 @@ int main(int argc, char **argv) #ifdef ENABLE_WRAPPING bool forced_wrapping = FALSE; /* Should long lines be automatically hard wrapped? */ -#endif -#ifdef ENABLE_MULTIBUFFER - bool is_multibuffer; - /* The actual value of the multibuffer option, restored after - * we've loaded all files given on the command line. */ #endif const struct option long_options[] = { {"boldtext", 0, NULL, 'D'}, @@ -2595,13 +2596,8 @@ int main(int argc, char **argv) fprintf(stderr, "Main: open file\n"); #endif -#ifdef ENABLE_MULTIBUFFER - is_multibuffer = ISSET(MULTIBUFFER); - SET(MULTIBUFFER); -#endif - /* Read the files mentioned on the command line into new buffers. */ - while (optind < argc && (!openfile || ISSET(MULTIBUFFER))) { + while (optind < argc && (!openfile || read_them_all)) { ssize_t givenline = 0, givencol = 0; /* If there's a +LINE[,COLUMN] argument here, eat it up. */ @@ -2642,9 +2638,6 @@ int main(int argc, char **argv) #ifdef ENABLE_MULTIBUFFER else openfile = openfile->next; - - if (!is_multibuffer) - UNSET(MULTIBUFFER); #endif #ifdef DEBUG diff --git a/src/text.c b/src/text.c index d558225b..8e3843d3 100644 --- a/src/text.c +++ b/src/text.c @@ -3225,7 +3225,6 @@ void do_linter(void) statusbar(_("Cancelled")); goto free_lints_and_return; } else if (i == 1) { - SET(MULTIBUFFER); open_buffer(curlint->filename, TRUE); } else { char *dontwantfile = mallocstrcpy(NULL, curlint->filename);