nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 368f1a1c9d20fa8595d9071054f6b92c7d65c794
parent 527c6c1ca0d07a7edf6feda324782cceb1d8f882
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Thu, 16 May 2019 16:14:15 +0200

tweaks: elide a function that is called in just one place

Since commit b5f15cb5 from a year ago, there remains just one call
of initialize_buffer_text().

Diffstat:
Msrc/files.c | 25+++++++++----------------
Msrc/proto.h | 1-
2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/src/files.c b/src/files.c @@ -88,11 +88,19 @@ void make_new_buffer(void) openfile->filename = mallocstrcpy(NULL, ""); - initialize_buffer_text(); + openfile->filetop = make_new_node(NULL); + openfile->filetop->data = mallocstrcpy(NULL, ""); + openfile->filebot = openfile->filetop; + openfile->current = openfile->filetop; + openfile->current_x = 0; openfile->placewewant = 0; openfile->current_y = 0; + openfile->edittop = openfile->filetop; + openfile->firstcolumn = 0; + + openfile->totsize = 0; openfile->modified = FALSE; #ifdef ENABLE_WRAPPING openfile->spillage_line = NULL; @@ -116,21 +124,6 @@ void make_new_buffer(void) #endif } -/* Initialize the text and pointers of the current openfile struct. */ -void initialize_buffer_text(void) -{ - openfile->filetop = make_new_node(NULL); - openfile->filetop->data = mallocstrcpy(NULL, ""); - - openfile->filebot = openfile->filetop; - openfile->edittop = openfile->filetop; - openfile->current = openfile->filetop; - - openfile->firstcolumn = 0; - openfile->current_x = 0; - openfile->totsize = 0; -} - /* Mark the current file as modified if it isn't already, and then * update the titlebar to display the file's new status. */ void set_modified(void) diff --git a/src/proto.h b/src/proto.h @@ -263,7 +263,6 @@ void zap_text(void); void paste_text(void); /* Most functions in files.c. */ -void initialize_buffer_text(void); void set_modified(void); bool open_buffer(const char *filename, bool new_buffer); #ifdef ENABLE_SPELLER