commit a3a10dfafeceba3ef99a6804894283f3aa0cecab
parent 850e538ff7215272e7a810203b8a0382bdef5f24
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 10 May 2018 18:00:05 +0200
tweaks: don't bother having debug code that deallocates all memory
Who runs debug builds for any length of time?
Diffstat:
3 files changed, 7 insertions(+), 117 deletions(-)
diff --git a/src/global.c b/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 */
diff --git a/src/nano.c b/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);
}
diff --git a/src/proto.h b/src/proto.h
@@ -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