tweaks: don't bother having debug code that deallocates all memory
Who runs debug builds for any length of time?master
parent
850e538ff7
commit
a3a10dfafe
110
src/global.c
110
src/global.c
|
@ -1723,113 +1723,3 @@ char *menu_to_name(int menu)
|
|||
return "boooo";
|
||||
}
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
/* This function is used to gracefully return all the memory we've used.
|
||||
* It should be called just before calling exit(). Practically, the
|
||||
* only effect is to cause a segmentation fault if the various data
|
||||
* structures got bolloxed earlier. Thus, we don't bother having this
|
||||
* function unless debugging is turned on. */
|
||||
void thanks_for_all_the_fish(void)
|
||||
{
|
||||
if (topwin != NULL)
|
||||
delwin(topwin);
|
||||
delwin(edit);
|
||||
delwin(bottomwin);
|
||||
|
||||
free(word_chars);
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
free(quotestr);
|
||||
regfree("ereg);
|
||||
free(quoteerr);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
free(backup_dir);
|
||||
#endif
|
||||
#ifdef ENABLE_OPERATINGDIR
|
||||
free(operating_dir);
|
||||
#endif
|
||||
free(answer);
|
||||
free(last_search);
|
||||
free(present_path);
|
||||
#ifdef ENABLE_SPELLER
|
||||
free(alt_speller);
|
||||
#endif
|
||||
free_filestruct(cutbuffer);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* Free the memory associated with each open file buffer. */
|
||||
while (openfile != openfile->next) {
|
||||
openfile = openfile->next;
|
||||
delete_opennode(openfile->prev);
|
||||
}
|
||||
delete_opennode(openfile);
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
free(syntaxstr);
|
||||
while (syntaxes != NULL) {
|
||||
syntaxtype *sint = syntaxes;
|
||||
syntaxes = syntaxes->next;
|
||||
|
||||
free(sint->name);
|
||||
free(sint->linter);
|
||||
|
||||
while (sint->extensions != NULL) {
|
||||
regexlisttype *item = sint->extensions;
|
||||
sint->extensions = sint->extensions->next;
|
||||
free(item->full_regex);
|
||||
free(item);
|
||||
}
|
||||
while (sint->headers != NULL) {
|
||||
regexlisttype *item = sint->headers;
|
||||
sint->headers = sint->headers->next;
|
||||
free(item->full_regex);
|
||||
free(item);
|
||||
}
|
||||
while (sint->magics != NULL) {
|
||||
regexlisttype *item = sint->magics;
|
||||
sint->magics = sint->magics->next;
|
||||
free(item->full_regex);
|
||||
free(item);
|
||||
}
|
||||
|
||||
while (sint->color != NULL) {
|
||||
colortype *ink = sint->color;
|
||||
sint->color = sint->color->next;
|
||||
free(ink->start_regex);
|
||||
if (ink->start != NULL) {
|
||||
regfree(ink->start);
|
||||
free(ink->start);
|
||||
}
|
||||
free(ink->end_regex);
|
||||
if (ink->end != NULL) {
|
||||
regfree(ink->end);
|
||||
free(ink->end);
|
||||
}
|
||||
free(ink);
|
||||
}
|
||||
|
||||
free(sint);
|
||||
}
|
||||
#endif /* ENABLE_COLOR */
|
||||
#ifdef ENABLE_HISTORIES
|
||||
/* Free the search, replace, and execute history lists. */
|
||||
free_filestruct(searchtop);
|
||||
free_filestruct(replacetop);
|
||||
free_filestruct(executetop);
|
||||
#endif
|
||||
/* Free the list of functions. */
|
||||
while (allfuncs != NULL) {
|
||||
subnfunc *f = allfuncs;
|
||||
allfuncs = allfuncs->next;
|
||||
free(f);
|
||||
}
|
||||
/* Free the list of shortcuts. */
|
||||
while (sclist != NULL) {
|
||||
sc *s = sclist;
|
||||
sclist = sclist->next;
|
||||
free(s);
|
||||
}
|
||||
free(homedir);
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
|
11
src/nano.c
11
src/nano.c
|
@ -566,6 +566,13 @@ void finish(void)
|
|||
blank_bottombars();
|
||||
wrefresh(bottomwin);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Deallocate the two or three subwindows. */
|
||||
if (topwin != NULL)
|
||||
delwin(topwin);
|
||||
delwin(edit);
|
||||
delwin(bottomwin);
|
||||
#endif
|
||||
/* Switch on the cursor and exit from curses mode. */
|
||||
curs_set(1);
|
||||
endwin();
|
||||
|
@ -582,10 +589,6 @@ void finish(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
thanks_for_all_the_fish();
|
||||
#endif
|
||||
|
||||
/* Get out. */
|
||||
exit(0);
|
||||
}
|
||||
|
|
|
@ -333,9 +333,6 @@ sc *strtosc(const char *input);
|
|||
int name_to_menu(const char *name);
|
||||
char *menu_to_name(int menu);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
void thanks_for_all_the_fish(void);
|
||||
#endif
|
||||
|
||||
/* All functions in help.c. */
|
||||
#ifdef ENABLE_HELP
|
||||
|
|
Loading…
Reference in New Issue