From 88087f2b2f7dcf340a843ae306f8bc12df2376ad Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 2 Feb 2020 12:25:09 +0100 Subject: [PATCH] tweaks: move a function to related ones, and after one that it calls --- src/files.c | 32 ++++++++++++++++---------------- src/proto.h | 3 +-- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/files.c b/src/files.c index cfa8e9ea..c10e13c8 100644 --- a/src/files.c +++ b/src/files.c @@ -131,22 +131,6 @@ void make_new_buffer(void) #endif } -/* Mark the current file as modified if it isn't already, and - * then update the title bar to display the file's new status. */ -void set_modified(void) -{ - if (openfile->modified) - return; - - openfile->modified = TRUE; - titlebar(NULL); - -#ifndef NANO_TINY - if (openfile->lock_filename != NULL) - write_lockfile(openfile->lock_filename, openfile->filename, TRUE); -#endif -} - #ifndef NANO_TINY /* Delete the lockfile. Return -1 if unsuccessful, and 1 otherwise. */ int delete_lockfile(const char *lockfilename) @@ -536,6 +520,22 @@ bool replace_buffer(const char *filename, undo_type action, bool marked, } #endif /* ENABLE_SPELLER */ +/* Mark the current file as modified if it isn't already, and + * then update the title bar to display the file's new status. */ +void set_modified(void) +{ + if (openfile->modified) + return; + + openfile->modified = TRUE; + titlebar(NULL); + +#ifndef NANO_TINY + if (openfile->lock_filename != NULL) + write_lockfile(openfile->lock_filename, openfile->filename, TRUE); +#endif +} + /* Update the title bar and the multiline cache to match the current buffer. */ void prepare_for_display(void) { diff --git a/src/proto.h b/src/proto.h index c03ddd5a..775019cb 100644 --- a/src/proto.h +++ b/src/proto.h @@ -282,12 +282,12 @@ void make_new_buffer(void); #ifndef NANO_TINY int delete_lockfile(const char *lockfilename); #endif -void set_modified(void); bool open_buffer(const char *filename, bool new_buffer); #ifdef ENABLE_SPELLER bool replace_buffer(const char *filename, undo_type action, bool marked, const char *operation); #endif +void set_modified(void); void prepare_for_display(void); #ifdef ENABLE_MULTIBUFFER void mention_name_and_linecount(void); @@ -307,7 +307,6 @@ bool outside_of_confinement(const char *currpath, bool allow_tabcomp); #endif #ifndef NANO_TINY void init_backup_dir(void); -int write_lockfile(const char *lockfilename, const char *filename, bool modified); #endif int copy_file(FILE *inn, FILE *out, bool close_out); bool write_file(const char *name, FILE *f_open, bool tmp,