diff --git a/src/nano.c b/src/nano.c index e06458bb34ef1ad8252541f33073cca6d8e5c1dc..9285c98fe6795144012c642de6a64467eaccd9cf 100644 --- a/src/nano.c +++ b/src/nano.c @@ -353,14 +353,10 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot, } /* Since the text has now been saved, remove it from the filestruct. */ - openfile->fileage = (filestruct *)nmalloc(sizeof(filestruct)); + openfile->fileage = make_new_node(NULL); openfile->fileage->data = mallocstrcpy(NULL, ""); openfile->filebot = openfile->fileage; -#ifndef DISABLE_COLOR - openfile->fileage->multidata = NULL; -#endif - /* Restore the current line and cursor position. If the mark begins * inside the partition, set the beginning of the mark to where the * saved text used to start. */ diff --git a/src/utils.c b/src/utils.c index 4d018f81428549e00065ce1ca0fd5ef6dd5aadb2..07dad2d7bc883f62703d329c82ee6c01cb5ba596 100644 --- a/src/utils.c +++ b/src/utils.c @@ -530,14 +530,8 @@ size_t strlenpt(const char *text) /* Append a new magicline to filebot. */ void new_magicline(void) { - openfile->filebot->next = (filestruct *)nmalloc(sizeof(filestruct)); + openfile->filebot->next = make_new_node(openfile->filebot); openfile->filebot->next->data = mallocstrcpy(NULL, ""); - openfile->filebot->next->prev = openfile->filebot; - openfile->filebot->next->next = NULL; - openfile->filebot->next->lineno = openfile->filebot->lineno + 1; -#ifndef DISABLE_COLOR - openfile->filebot->next->multidata = NULL; -#endif openfile->filebot = openfile->filebot->next; openfile->totsize++; }