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) {
/* 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;

View File

@ -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) {

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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;) {

View File

@ -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')