From 8925eabd5e201138d0886c2423b98a23cacab1ce Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 16 Aug 2015 15:21:32 +0000 Subject: [PATCH] Not bothering to set things to NULL when they will be initialized right away, nor bothering with a separate initialization function when it's used only once. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5365 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 ++++ src/files.c | 10 +--------- src/nano.c | 11 +---------- src/proto.h | 1 - 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index c3290e02..d49e6f9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,10 @@ * src/help.c (help_line_len): Rename and reorder most of it. * src/nano.c (make_new_opennode), src/files.c (initialize_buffer): Remove some duplication in the initialization of a new openfile node. + * src/nano.c (make_new_opennode): Don't bother setting things to NULL + when they will be intialized right away. + * src/files.c (make_new_buffer): Don't bother with a separate function + when it's used only once, right there. 2015-08-13 Benno Schulenberg * src/search.c (do_find_bracket): Remove mistaken comparison between diff --git a/src/files.c b/src/files.c index 2c4fe297..63d54cb6 100644 --- a/src/files.c +++ b/src/files.c @@ -51,15 +51,7 @@ void make_new_buffer(void) exitfunc->desc = close_tag; } - /* Initialize the new buffer. */ - initialize_buffer(); -} - -/* Initialize the current entry of the openfile openfilestruct. */ -void initialize_buffer(void) -{ - assert(openfile != NULL); - + /* Start initializing the new buffer. */ openfile->filename = mallocstrcpy(NULL, ""); initialize_buffer_text(); diff --git a/src/nano.c b/src/nano.c index 903e2ba4..5d1a2ba8 100644 --- a/src/nano.c +++ b/src/nano.c @@ -517,16 +517,7 @@ void copy_from_filestruct(filestruct *somebuffer) /* Create a new openfilestruct node. */ openfilestruct *make_new_opennode(void) { - openfilestruct *newnode = - (openfilestruct *)nmalloc(sizeof(openfilestruct)); - - newnode->filename = NULL; - newnode->fileage = NULL; - newnode->filebot = NULL; - newnode->edittop = NULL; - newnode->current = NULL; - - return newnode; + return (openfilestruct *)nmalloc(sizeof(openfilestruct)); } /* Splice a node into an existing openfilestruct. */ diff --git a/src/proto.h b/src/proto.h index 2192b151..5083b21b 100644 --- a/src/proto.h +++ b/src/proto.h @@ -274,7 +274,6 @@ void do_uncut_text(void); /* All functions in files.c. */ void make_new_buffer(void); -void initialize_buffer(void); void initialize_buffer_text(void); void open_buffer(const char *filename, bool undoable); #ifndef DISABLE_SPELLER