diff --git a/src/files.c b/src/files.c index 10e2f624cbcda5f4f5f795928ee91813829d05e8..c32fce1ba0a3d582da603546deb68f84498e1605 100644 --- a/src/files.c +++ b/src/files.c @@ -66,16 +66,19 @@ void make_new_buffer(void) if (openfile == NULL) { /* Make the first open file the only element in the list. */ +#ifdef ENABLE_MULTIBUFFER newnode->prev = newnode; newnode->next = newnode; +#endif firstfile = newnode; } else { /* Add the new open file after the current one in the list. */ +#ifdef ENABLE_MULTIBUFFER newnode->prev = openfile; newnode->next = openfile->next; openfile->next->prev = newnode; openfile->next = newnode; - +#endif /* There is more than one file open: show "Close" in help lines. */ exitfunc->desc = close_tag; more_than_one = !inhelp || more_than_one; diff --git a/src/global.c b/src/global.c index 1bf5c261b5ac087b5f9a157ba4d4e06d80ff8261..41d63833017548d05ed5da8ef6ec9bc3cbdd3a6b 100644 --- a/src/global.c +++ b/src/global.c @@ -1779,12 +1779,14 @@ void thanks_for_all_the_fish(void) free(alt_speller); #endif free_filestruct(cutbuffer); +#ifdef ENABLE_MULTIBUFFER /* Free the memory associated with each open file buffer. */ while (openfile != openfile->next) { openfile = openfile->next; delete_opennode(openfile->prev); } delete_opennode(openfile); +#endif #ifdef ENABLE_COLOR free(syntaxstr); while (syntaxes != NULL) { diff --git a/src/nano.c b/src/nano.c index 7f593a3dbf4fd5f82df987e323a78ef7e2816e7e..878309c9e0f6b30526032b6484175492a467a9d4 100644 --- a/src/nano.c +++ b/src/nano.c @@ -512,17 +512,19 @@ openfilestruct *make_new_opennode(void) return (openfilestruct *)nmalloc(sizeof(openfilestruct)); } +#ifdef ENABLE_MULTIBUFFER /* Unlink a node from the rest of the circular list, and delete it. */ void unlink_opennode(openfilestruct *fileptr) { assert(fileptr != fileptr->prev && fileptr != fileptr->next); +#ifdef ENABLE_MULTIBUFFER if (fileptr == firstfile) firstfile = firstfile->next; fileptr->prev->next = fileptr->next; fileptr->next->prev = fileptr->prev; - +#endif delete_opennode(fileptr); } @@ -539,6 +541,7 @@ void delete_opennode(openfilestruct *fileptr) #endif free(fileptr); } +#endif /* Display a warning about a key disabled in view mode. */ void print_view_warning(void) diff --git a/src/nano.h b/src/nano.h index d3f878601f79fed29f2004194e3e97b1b6bd9f94..5812b5064d5294ac41e8ec3ed42f5a23662fa94e 100644 --- a/src/nano.h +++ b/src/nano.h @@ -408,10 +408,12 @@ typedef struct openfilestruct { colortype *colorstrings; /* The file's associated colors. */ #endif +#ifdef ENABLE_MULTIBUFFER struct openfilestruct *next; /* The next open file, if any. */ struct openfilestruct *prev; /* The preceding open file, if any. */ +#endif } openfilestruct; #ifdef ENABLE_NANORC diff --git a/src/proto.h b/src/proto.h index 2d6ebfc13cdbb4db362f142c38174b549772006f..befabe4a5f4d64fe4bae92371653eefcb8f609fd 100644 --- a/src/proto.h +++ b/src/proto.h @@ -410,8 +410,10 @@ void extract_buffer(filestruct **file_top, filestruct **file_bot, void ingraft_buffer(filestruct *somebuffer); void copy_from_buffer(filestruct *somebuffer); openfilestruct *make_new_opennode(void); +#ifdef ENABLE_MULTIBUFFER void unlink_opennode(openfilestruct *fileptr); void delete_opennode(openfilestruct *fileptr); +#endif void print_view_warning(void); void show_restricted_warning(void); #ifndef ENABLE_HELP diff --git a/src/text.c b/src/text.c index efe123fdaad86682de0fa92611b05081d7fa36a0..37fea69bb6572e82ff5854e1851b71708ac635de 100644 --- a/src/text.c +++ b/src/text.c @@ -3200,7 +3200,7 @@ void do_linter(void) functionptrtype func; if (tmplint != curlint) { -#ifndef NANO_TINY +#ifdef ENABLE_MULTIBUFFER struct stat lintfileinfo; new_lint_loop: @@ -3265,7 +3265,7 @@ void do_linter(void) openfile = tmpof; } } -#endif /* !NANO_TINY */ +#endif /* ENABLE_MULTIBUFFER */ goto_line_posx(curlint->lineno, curlint->colno - 1); titlebar(NULL); adjust_viewport(CENTERING); @@ -3307,7 +3307,7 @@ void do_linter(void) wipe_statusbar(); -#ifndef NANO_TINY +#ifdef ENABLE_MULTIBUFFER free_lints_and_return: #endif for (curlint = lints; curlint != NULL;) { diff --git a/src/winio.c b/src/winio.c index 9257fe79d8e4cfc63644d4e4256798a4e7937c4e..b1488d5b337fcdbcb740afab86d0c1376dcb5197 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1973,6 +1973,7 @@ char *display_string(const char *buf, size_t column, size_t span, bool isdata) return converted; } +#ifdef ENABLE_MULTIBUFFER /* Determine the sequence number of the given buffer in the circular list. */ int buffer_number(openfilestruct *buffer) { @@ -1985,6 +1986,7 @@ int buffer_number(openfilestruct *buffer) return count; } +#endif /* If path is NULL, we're in normal editing mode, so display the current * version of nano, the current filename, and whether the current file @@ -2030,6 +2032,7 @@ void titlebar(const char *path) else #endif if (!inhelp) { +#ifdef ENABLE_MULTIBUFFER /* If there are/were multiple buffers, show which out of how many. */ if (more_than_one) { indicator = charalloc(24); @@ -2037,6 +2040,7 @@ void titlebar(const char *path) buffer_number(firstfile->prev)); upperleft = indicator; } else +#endif upperleft = BRANDING; if (openfile->filename[0] == '\0')