commit d3c7e9d2f65e5ba688c8b2d4b7eb629110c5e18a
parent ea4bbf4285c45a206bdf8fbd6fe2d9d6cc66f161
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 8 Nov 2021 16:41:44 +0100
tweaks: rename two functions, to get rid of another senseless suffix
Diffstat:
6 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -2084,13 +2084,12 @@ bool write_region_to_file(const char *name, FILE *stream, bool normal,
}
#endif /* !NANO_TINY */
-/* Write the current buffer to disk. If the mark is on, write the current
- * marked selection to disk. If exiting is TRUE, write the entire buffer
- * to disk regardless of whether the mark is on. Do not ask for a name
- * when withprompt is FALSE nor when the SAVE_ON_EXIT flag is set and the
- * buffer already has a name. Return 0 on error, 1 on success, and 2 when
+/* Write the current buffer (or marked region) to disk. If exiting is TRUE,
+ * write the entire buffer regardless of whether the mark is on. Do not ask
+ * for a name when withprompt is FALSE (nor when doing save-on-exit and the
+ * buffer already has a name). Return 0 on error, 1 on success, and 2 when
* the buffer is to be discarded. */
-int do_writeout(bool exiting, bool withprompt)
+int write_it_out(bool exiting, bool withprompt)
{
char *given;
/* The filename we offer, or what the user typed so far. */
@@ -2329,17 +2328,17 @@ int do_writeout(bool exiting, bool withprompt)
}
/* Write the current buffer to disk, or discard it. */
-void do_writeout_void(void)
+void do_writeout(void)
{
/* If the user chose to discard the buffer, close it. */
- if (do_writeout(FALSE, TRUE) == 2)
+ if (write_it_out(FALSE, TRUE) == 2)
close_and_go();
}
/* If it has a name, write the current buffer to disk without prompting. */
void do_savefile(void)
{
- if (do_writeout(FALSE, FALSE) == 2)
+ if (write_it_out(FALSE, FALSE) == 2)
close_and_go();
}
diff --git a/src/global.c b/src/global.c
@@ -720,7 +720,7 @@ void shortcut_init(void)
add_to_funcs(flip_goto, MGOTOLINE, "Go To Text", "x", 0, VIEW);
#endif
- add_to_funcs(do_writeout_void, MMAIN,
+ add_to_funcs(do_writeout, MMAIN,
N_("Write Out"), WITHORSANS(writeout_gist), TOGETHER, NOVIEW);
#ifdef ENABLE_JUSTIFY
@@ -1171,7 +1171,7 @@ void shortcut_init(void)
add_to_sclist(MMAIN|MBROWSER|MHELP, "^X", 0, do_exit, 0);
if (!ISSET(PRESERVE))
add_to_sclist(MMAIN, "^S", 0, do_savefile, 0);
- add_to_sclist(MMAIN, "^O", 0, do_writeout_void, 0);
+ add_to_sclist(MMAIN, "^O", 0, do_writeout, 0);
add_to_sclist(MMAIN, "^R", 0, do_insertfile_void, 0);
add_to_sclist(MMAIN, "Ins", KEY_IC, do_insertfile_void, 0);
if (!ISSET(PRESERVE))
@@ -1468,7 +1468,7 @@ void shortcut_init(void)
#endif
add_to_sclist(MMOST & ~MFINDINHELP, "F1", KEY_F(1), do_help, 0);
add_to_sclist(MMAIN|MBROWSER|MHELP, "F2", KEY_F(2), do_exit, 0);
- add_to_sclist(MMAIN, "F3", KEY_F(3), do_writeout_void, 0);
+ add_to_sclist(MMAIN, "F3", KEY_F(3), do_writeout, 0);
#ifdef ENABLE_JUSTIFY
add_to_sclist(MMAIN, "F4", KEY_F(4), do_justify, 0);
#endif
diff --git a/src/nano.c b/src/nano.c
@@ -315,7 +315,7 @@ void do_exit(void)
}
/* When not saving, or the save succeeds, close the buffer. */
- if (choice == 0 || (choice == 1 && do_writeout(TRUE, TRUE) > 0))
+ if (choice == 0 || (choice == 1 && write_it_out(TRUE, TRUE) > 0))
close_and_go();
else if (choice != 1)
statusbar(_("Cancelled"));
diff --git a/src/prototypes.h b/src/prototypes.h
@@ -302,8 +302,8 @@ bool write_file(const char *name, FILE *thefile, bool normal,
bool write_region_to_file(const char *name, FILE *stream, bool normal,
kind_of_writing_type method);
#endif
-int do_writeout(bool exiting, bool withprompt);
-void do_writeout_void(void);
+int write_it_out(bool exiting, bool withprompt);
+void do_writeout(void);
void do_savefile(void);
char *real_dir_from_tilde(const char *path);
#if defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
diff --git a/src/rcfile.c b/src/rcfile.c
@@ -242,7 +242,7 @@ keystruct *strtosc(const char *input)
else if (!strcmp(input, "discardbuffer"))
s->func = discard_buffer;
else if (!strcmp(input, "writeout"))
- s->func = do_writeout_void;
+ s->func = do_writeout;
else if (!strcmp(input, "savefile"))
s->func = do_savefile;
else if (!strcmp(input, "insert"))
diff --git a/src/text.c b/src/text.c
@@ -2563,7 +2563,7 @@ void do_linter(void)
if (choice == -1) {
statusbar(_("Cancelled"));
return;
- } else if (choice == 1 && (do_writeout(FALSE, FALSE) != 1))
+ } else if (choice == 1 && (write_it_out(FALSE, FALSE) != 1))
return;
}