diff --git a/ChangeLog b/ChangeLog index 961aa996d9babe3d833e3ba548bc0b977fc56669..31676ccf02aab027f9fc964d6f9bb8881863157b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2016-02-22 Benno Schulenberg <bensberg@justemail.net> + * src/nano.c (free_openfilestruct): Elide this function. + 2016-02-21 Benno Schulenberg <bensberg@justemail.net> * src/files.c (input_tab): If the first Tab added the part that all matches have in common, don't require a third Tab to show the list. diff --git a/src/global.c b/src/global.c index 1dfd35d94b5c84bbb80f4f477f06b6a5b8e0b480..35d8c518245e4de6d89f7500cb81039491544e4a 100644 --- a/src/global.c +++ b/src/global.c @@ -1659,8 +1659,11 @@ void thanks_for_all_the_fish(void) free_filestruct(jusbuffer); #endif /* Free the memory associated with each open file buffer. */ - if (openfile != NULL) - free_openfilestruct(openfile); + while (openfile != openfile->next) { + openfile = openfile->next; + delete_opennode(openfile->prev); + } + delete_opennode(openfile); #ifndef DISABLE_COLOR free(syntaxstr); while (syntaxes != NULL) { diff --git a/src/nano.c b/src/nano.c index 84e0e369832c90593df56b5368b1b1d95d51206c..8102d40fc0d5b165be24e29bb5ff803b72e89768 100644 --- a/src/nano.c +++ b/src/nano.c @@ -551,7 +551,7 @@ void unlink_opennode(openfilestruct *fileptr) delete_opennode(fileptr); } -/* Delete a node from the openfilestruct. */ +/* Free all the memory in the given open-file node. */ void delete_opennode(openfilestruct *fileptr) { assert(fileptr != NULL && fileptr->filename != NULL && fileptr->fileage != NULL); @@ -567,22 +567,6 @@ void delete_opennode(openfilestruct *fileptr) free(fileptr); } -#ifdef DEBUG -/* Deallocate all memory associated with this and later files, including - * the lines of text. */ -void free_openfilestruct(openfilestruct *src) -{ - assert(src != NULL); - - while (src != src->next) { - src = src->next; - delete_opennode(src->prev); - } - - delete_opennode(src); -} -#endif - /* 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 index 864e5e8982323be18a49b31082e8d81af474a00a..a3ff103d15e290581e80594c51980db8a198f26d 100644 --- a/src/proto.h +++ b/src/proto.h @@ -451,9 +451,6 @@ void splice_opennode(openfilestruct *begin, openfilestruct *newnode, openfilestruct *end); void unlink_opennode(openfilestruct *fileptr); void delete_opennode(openfilestruct *fileptr); -#ifdef DEBUG -void free_openfilestruct(openfilestruct *src); -#endif void print_view_warning(void); void show_restricted_warning(void); #ifdef DISABLE_HELP