build: exclude more things when configured with --disable-multibuffer

This will make the tiny version slightly smaller.
master
Benno Schulenberg 2018-03-23 10:53:06 +01:00
parent b7f8d4819b
commit bf1a080923
7 changed files with 21 additions and 5 deletions

View File

@ -66,16 +66,19 @@ void make_new_buffer(void)
if (openfile == NULL) { if (openfile == NULL) {
/* Make the first open file the only element in the list. */ /* Make the first open file the only element in the list. */
#ifdef ENABLE_MULTIBUFFER
newnode->prev = newnode; newnode->prev = newnode;
newnode->next = newnode; newnode->next = newnode;
#endif
firstfile = newnode; firstfile = newnode;
} else { } else {
/* Add the new open file after the current one in the list. */ /* Add the new open file after the current one in the list. */
#ifdef ENABLE_MULTIBUFFER
newnode->prev = openfile; newnode->prev = openfile;
newnode->next = openfile->next; newnode->next = openfile->next;
openfile->next->prev = newnode; openfile->next->prev = newnode;
openfile->next = newnode; openfile->next = newnode;
#endif
/* There is more than one file open: show "Close" in help lines. */ /* There is more than one file open: show "Close" in help lines. */
exitfunc->desc = close_tag; exitfunc->desc = close_tag;
more_than_one = !inhelp || more_than_one; more_than_one = !inhelp || more_than_one;

View File

@ -1779,12 +1779,14 @@ void thanks_for_all_the_fish(void)
free(alt_speller); free(alt_speller);
#endif #endif
free_filestruct(cutbuffer); free_filestruct(cutbuffer);
#ifdef ENABLE_MULTIBUFFER
/* Free the memory associated with each open file buffer. */ /* Free the memory associated with each open file buffer. */
while (openfile != openfile->next) { while (openfile != openfile->next) {
openfile = openfile->next; openfile = openfile->next;
delete_opennode(openfile->prev); delete_opennode(openfile->prev);
} }
delete_opennode(openfile); delete_opennode(openfile);
#endif
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
free(syntaxstr); free(syntaxstr);
while (syntaxes != NULL) { while (syntaxes != NULL) {

View File

@ -512,17 +512,19 @@ openfilestruct *make_new_opennode(void)
return (openfilestruct *)nmalloc(sizeof(openfilestruct)); return (openfilestruct *)nmalloc(sizeof(openfilestruct));
} }
#ifdef ENABLE_MULTIBUFFER
/* Unlink a node from the rest of the circular list, and delete it. */ /* Unlink a node from the rest of the circular list, and delete it. */
void unlink_opennode(openfilestruct *fileptr) void unlink_opennode(openfilestruct *fileptr)
{ {
assert(fileptr != fileptr->prev && fileptr != fileptr->next); assert(fileptr != fileptr->prev && fileptr != fileptr->next);
#ifdef ENABLE_MULTIBUFFER
if (fileptr == firstfile) if (fileptr == firstfile)
firstfile = firstfile->next; firstfile = firstfile->next;
fileptr->prev->next = fileptr->next; fileptr->prev->next = fileptr->next;
fileptr->next->prev = fileptr->prev; fileptr->next->prev = fileptr->prev;
#endif
delete_opennode(fileptr); delete_opennode(fileptr);
} }
@ -539,6 +541,7 @@ void delete_opennode(openfilestruct *fileptr)
#endif #endif
free(fileptr); free(fileptr);
} }
#endif
/* Display a warning about a key disabled in view mode. */ /* Display a warning about a key disabled in view mode. */
void print_view_warning(void) void print_view_warning(void)

View File

@ -408,10 +408,12 @@ typedef struct openfilestruct {
colortype *colorstrings; colortype *colorstrings;
/* The file's associated colors. */ /* The file's associated colors. */
#endif #endif
#ifdef ENABLE_MULTIBUFFER
struct openfilestruct *next; struct openfilestruct *next;
/* The next open file, if any. */ /* The next open file, if any. */
struct openfilestruct *prev; struct openfilestruct *prev;
/* The preceding open file, if any. */ /* The preceding open file, if any. */
#endif
} openfilestruct; } openfilestruct;
#ifdef ENABLE_NANORC #ifdef ENABLE_NANORC

View File

@ -410,8 +410,10 @@ void extract_buffer(filestruct **file_top, filestruct **file_bot,
void ingraft_buffer(filestruct *somebuffer); void ingraft_buffer(filestruct *somebuffer);
void copy_from_buffer(filestruct *somebuffer); void copy_from_buffer(filestruct *somebuffer);
openfilestruct *make_new_opennode(void); openfilestruct *make_new_opennode(void);
#ifdef ENABLE_MULTIBUFFER
void unlink_opennode(openfilestruct *fileptr); void unlink_opennode(openfilestruct *fileptr);
void delete_opennode(openfilestruct *fileptr); void delete_opennode(openfilestruct *fileptr);
#endif
void print_view_warning(void); void print_view_warning(void);
void show_restricted_warning(void); void show_restricted_warning(void);
#ifndef ENABLE_HELP #ifndef ENABLE_HELP

View File

@ -3200,7 +3200,7 @@ void do_linter(void)
functionptrtype func; functionptrtype func;
if (tmplint != curlint) { if (tmplint != curlint) {
#ifndef NANO_TINY #ifdef ENABLE_MULTIBUFFER
struct stat lintfileinfo; struct stat lintfileinfo;
new_lint_loop: new_lint_loop:
@ -3265,7 +3265,7 @@ void do_linter(void)
openfile = tmpof; openfile = tmpof;
} }
} }
#endif /* !NANO_TINY */ #endif /* ENABLE_MULTIBUFFER */
goto_line_posx(curlint->lineno, curlint->colno - 1); goto_line_posx(curlint->lineno, curlint->colno - 1);
titlebar(NULL); titlebar(NULL);
adjust_viewport(CENTERING); adjust_viewport(CENTERING);
@ -3307,7 +3307,7 @@ void do_linter(void)
wipe_statusbar(); wipe_statusbar();
#ifndef NANO_TINY #ifdef ENABLE_MULTIBUFFER
free_lints_and_return: free_lints_and_return:
#endif #endif
for (curlint = lints; curlint != NULL;) { for (curlint = lints; curlint != NULL;) {

View File

@ -1973,6 +1973,7 @@ char *display_string(const char *buf, size_t column, size_t span, bool isdata)
return converted; return converted;
} }
#ifdef ENABLE_MULTIBUFFER
/* Determine the sequence number of the given buffer in the circular list. */ /* Determine the sequence number of the given buffer in the circular list. */
int buffer_number(openfilestruct *buffer) int buffer_number(openfilestruct *buffer)
{ {
@ -1985,6 +1986,7 @@ int buffer_number(openfilestruct *buffer)
return count; return count;
} }
#endif
/* If path is NULL, we're in normal editing mode, so display the current /* 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 * version of nano, the current filename, and whether the current file
@ -2030,6 +2032,7 @@ void titlebar(const char *path)
else else
#endif #endif
if (!inhelp) { if (!inhelp) {
#ifdef ENABLE_MULTIBUFFER
/* If there are/were multiple buffers, show which out of how many. */ /* If there are/were multiple buffers, show which out of how many. */
if (more_than_one) { if (more_than_one) {
indicator = charalloc(24); indicator = charalloc(24);
@ -2037,6 +2040,7 @@ void titlebar(const char *path)
buffer_number(firstfile->prev)); buffer_number(firstfile->prev));
upperleft = indicator; upperleft = indicator;
} else } else
#endif
upperleft = BRANDING; upperleft = BRANDING;
if (openfile->filename[0] == '\0') if (openfile->filename[0] == '\0')