tweaks: close a buffer differently and elide a parameter

This commit is contained in:
Benno Schulenberg 2019-05-31 09:15:12 +02:00
parent 3a65c0d192
commit c5d157dd9d
5 changed files with 12 additions and 12 deletions

View File

@ -462,8 +462,7 @@ bool open_buffer(const char *filename, bool new_buffer)
/* When not overriding an existing lock, discard the buffer. */
if (do_lockfile(realname) < 0) {
#ifdef ENABLE_MULTIBUFFER
openfile = openfile->prev;
close_buffer(openfile->next);
close_buffer();
#endif
free(realname);
return FALSE;
@ -645,10 +644,11 @@ void switch_to_next_buffer(void)
switch_to_adjacent_buffer(FORWARD);
}
/* Remove the given buffer from the circular list of buffers. */
void close_buffer(openfilestruct *buffer)
/* Remove the current buffer from the circular list of buffers. */
void close_buffer(void)
{
unlink_opennode(buffer);
openfile = openfile->prev;
unlink_opennode(openfile->next);
/* When just one buffer remains open, show "Exit" in the help lines. */
if (openfile == openfile->next)

View File

@ -223,9 +223,8 @@ void do_help(void)
}
}
/* Switch back to the original buffer and discard the help-text buffer. */
openfile = openfile->prev;
close_buffer(openfile->next);
/* Discard the help-text buffer. */
close_buffer();
/* Restore the settings of all flags. */
memcpy(flags, stash, sizeof(flags));

View File

@ -1044,7 +1044,9 @@ void close_and_go(void)
openfile->current->lineno, xplustabs() + 1);
#endif
switch_to_next_buffer();
close_buffer(openfile->prev);
openfile = openfile->prev;
close_buffer();
openfile = openfile->next;
/* Adjust the count in the top bar. */
titlebar(NULL);
} else

View File

@ -276,7 +276,7 @@ void prepare_for_display(void);
void mention_name_and_linecount(void);
void switch_to_prev_buffer(void);
void switch_to_next_buffer(void);
void close_buffer(openfilestruct *buffer);
void close_buffer(void);
#endif
void read_file(FILE *f, int fd, const char *filename, bool undoable);
int open_file(const char *filename, bool newfie, FILE **f);

View File

@ -3374,8 +3374,7 @@ void total_refresh(void)
titlebar(title);
#ifdef ENABLE_HELP
if (inhelp) {
openfile = openfile->prev;
close_buffer(openfile->next);
close_buffer();
wrap_help_text_into_buffer();
} else
#endif