tweaks: change a function to void, to make things more direct

master
Benno Schulenberg 2019-05-29 20:02:50 +02:00
parent 5f03c20ea0
commit 7e422402d5
3 changed files with 9 additions and 12 deletions

View File

@ -647,13 +647,10 @@ void switch_to_next_buffer(void)
switch_to_adjacent_buffer(FORWARD); switch_to_adjacent_buffer(FORWARD);
} }
/* Delete an entry from the circular list of open files, and switch to the /* Delete the current entry from the circular list of open files,
* one after it. Return FALSE if just one buffer is open, otherwise TRUE. */ * after switching to the buffer after it. */
bool close_buffer(void) void close_buffer(void)
{ {
if (openfile == openfile->next)
return FALSE;
#ifdef ENABLE_HISTORIES #ifdef ENABLE_HISTORIES
if (ISSET(POSITIONLOG) && !inhelp) if (ISSET(POSITIONLOG) && !inhelp)
update_poshistory(openfile->filename, update_poshistory(openfile->filename,
@ -670,8 +667,6 @@ bool close_buffer(void)
/* If now just one buffer remains open, show "Exit" in the help lines. */ /* If now just one buffer remains open, show "Exit" in the help lines. */
if (openfile == openfile->next) if (openfile == openfile->next)
exitfunc->desc = exit_tag; exitfunc->desc = exit_tag;
return TRUE;
} }
#endif /* ENABLE_MULTIBUFFER */ #endif /* ENABLE_MULTIBUFFER */

View File

@ -1027,7 +1027,7 @@ void do_exit(void)
statusbar(_("Cancelled")); statusbar(_("Cancelled"));
} }
/* Close the current buffer, and terminate nano if it was the last. */ /* Close the current buffer, or terminate nano if it is the last. */
void close_and_go(void) void close_and_go(void)
{ {
#ifndef NANO_TINY #ifndef NANO_TINY
@ -1036,8 +1036,10 @@ void close_and_go(void)
delete_lockfile(openfile->lock_filename); delete_lockfile(openfile->lock_filename);
#endif #endif
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
/* If there are no more open file buffers, jump off a cliff. */ /* If there is another buffer, close this one; otherwise terminate. */
if (!close_buffer()) if (openfile != openfile->next)
close_buffer();
else
#endif #endif
finish(); finish();
} }

View File

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