commit 20034139899491db6273017902d9ef729bceec3a
parent 9369af77cef3f83dceff28db70d3b1ef0d441ead
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 1 Jun 2019 10:52:38 +0200
tweaks: move a function to the file where it is used
Diffstat:
3 files changed, 20 insertions(+), 25 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -642,6 +642,26 @@ void switch_to_next_buffer(void)
redecorate_after_switch();
}
+/* Unlink a node from the rest of the circular list, and delete it. */
+void unlink_opennode(openfilestruct *fileptr)
+{
+ if (fileptr == startfile)
+ startfile = startfile->next;
+
+ fileptr->prev->next = fileptr->next;
+ fileptr->next->prev = fileptr->prev;
+
+ free(fileptr->filename);
+ free_lines(fileptr->filetop);
+#ifndef NANO_TINY
+ free(fileptr->current_stat);
+ free(fileptr->lock_filename);
+ /* Free the undo stack. */
+ discard_until(NULL, fileptr, TRUE);
+#endif
+ free(fileptr);
+}
+
/* Remove the current buffer from the circular list of buffers. */
void close_buffer(void)
{
diff --git a/src/nano.c b/src/nano.c
@@ -453,28 +453,6 @@ void copy_from_buffer(linestruct *somebuffer)
ingraft_buffer(the_copy);
}
-#ifdef ENABLE_MULTIBUFFER
-/* Unlink a node from the rest of the circular list, and delete it. */
-void unlink_opennode(openfilestruct *fileptr)
-{
- if (fileptr == startfile)
- startfile = startfile->next;
-
- fileptr->prev->next = fileptr->next;
- fileptr->next->prev = fileptr->prev;
-
- free(fileptr->filename);
- free_lines(fileptr->filetop);
-#ifndef NANO_TINY
- free(fileptr->current_stat);
- free(fileptr->lock_filename);
- /* Free the undo stack. */
- discard_until(NULL, fileptr, TRUE);
-#endif
- free(fileptr);
-}
-#endif /* ENABLE_MULTIBUFFER */
-
/* Display a warning about a key disabled in view mode. */
void print_view_warning(void)
{
diff --git a/src/proto.h b/src/proto.h
@@ -398,9 +398,6 @@ void unpartition_buffer();
void extract(linestruct *top, size_t top_x, linestruct *bot, size_t bot_x);
void ingraft_buffer(linestruct *somebuffer);
void copy_from_buffer(linestruct *somebuffer);
-#ifdef ENABLE_MULTIBUFFER
-void unlink_opennode(openfilestruct *fileptr);
-#endif
void print_view_warning(void);
void show_restricted_warning(void);
#ifndef ENABLE_HELP