commit 8925eabd5e201138d0886c2423b98a23cacab1ce
parent 149b1fe43960bb1d68fd7f8a752984ed7fa29820
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Sun, 16 Aug 2015 15:21:32 +0000
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
Diffstat:
4 files changed, 6 insertions(+), 20 deletions(-)
diff --git 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 <bensberg@justemail.net>
* src/search.c (do_find_bracket): Remove mistaken comparison between
diff --git 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
@@ -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
@@ -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