Eliding the function free_openfilestruct() as it is used only once.

(Note that openfile cannot be NULL here.  And in case it is,
nano should crash because DEBUG is enabled.)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5658 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2016-02-22 09:02:58 +00:00
parent 814a4220a2
commit f4f9954556
4 changed files with 9 additions and 22 deletions

View File

@ -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> 2016-02-21 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (input_tab): If the first Tab added the part that all * 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. matches have in common, don't require a third Tab to show the list.

View File

@ -1659,8 +1659,11 @@ void thanks_for_all_the_fish(void)
free_filestruct(jusbuffer); free_filestruct(jusbuffer);
#endif #endif
/* Free the memory associated with each open file buffer. */ /* Free the memory associated with each open file buffer. */
if (openfile != NULL) while (openfile != openfile->next) {
free_openfilestruct(openfile); openfile = openfile->next;
delete_opennode(openfile->prev);
}
delete_opennode(openfile);
#ifndef DISABLE_COLOR #ifndef DISABLE_COLOR
free(syntaxstr); free(syntaxstr);
while (syntaxes != NULL) { while (syntaxes != NULL) {

View File

@ -551,7 +551,7 @@ void unlink_opennode(openfilestruct *fileptr)
delete_opennode(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) void delete_opennode(openfilestruct *fileptr)
{ {
assert(fileptr != NULL && fileptr->filename != NULL && fileptr->fileage != NULL); assert(fileptr != NULL && fileptr->filename != NULL && fileptr->fileage != NULL);
@ -567,22 +567,6 @@ void delete_opennode(openfilestruct *fileptr)
free(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. */ /* Display a warning about a key disabled in view mode. */
void print_view_warning(void) void print_view_warning(void)
{ {

View File

@ -451,9 +451,6 @@ void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
openfilestruct *end); openfilestruct *end);
void unlink_opennode(openfilestruct *fileptr); void unlink_opennode(openfilestruct *fileptr);
void delete_opennode(openfilestruct *fileptr); void delete_opennode(openfilestruct *fileptr);
#ifdef DEBUG
void free_openfilestruct(openfilestruct *src);
#endif
void print_view_warning(void); void print_view_warning(void);
void show_restricted_warning(void); void show_restricted_warning(void);
#ifdef DISABLE_HELP #ifdef DISABLE_HELP