From: nethack.rankin Date: Sat, 15 Nov 2003 08:09:18 +0000 (+0000) Subject: autopickup exceptions X-Git-Tag: MOVE2GIT~1593 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=23d3a146d967786f0957dcf1a862604e10c27433;p=nethack autopickup exceptions External names longer than 31 characters trigger a compiler warning for me about truncation, and that causes make to quit. So shorten the two long names. Also, call the cleanup routine for the FREE_ALL_MEMORY configuration. --- diff --git a/include/extern.h b/include/extern.h index f777c3bca..5c8e3d055 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1417,8 +1417,8 @@ E void FDECL(set_wc_option_mod_status, (unsigned long, int)); E void FDECL(set_wc2_option_mod_status, (unsigned long, int)); E void FDECL(set_option_mod_status, (const char *,int)); #ifdef AUTOPICKUP_EXCEPTIONS -E int FDECL(add_autopickup_exception_mapping, (const char *)); -E void NDECL(free_autopickup_exception_mappings); +E int FDECL(add_autopickup_exception, (const char *)); +E void NDECL(free_autopickup_exceptions); #endif /* AUTOPICKUP_EXCEPTIONS */ /* ### pager.c ### */ diff --git a/src/files.c b/src/files.c index e50e5f75e..5113cbb86 100644 --- a/src/files.c +++ b/src/files.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)files.c 3.4 2003/02/18 */ +/* SCCS Id: @(#)files.c 3.4 2003/11/14 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1745,7 +1745,7 @@ char *tmp_levels; plnamesuffix(); /* set the character class */ #ifdef AUTOPICKUP_EXCEPTIONS } else if (match_varname(buf, "AUTOPICKUP_EXCEPTION", 5)) { - add_autopickup_exception_mapping(bufp); + add_autopickup_exception(bufp); #endif #ifdef NOCWD_ASSUMPTIONS } else if (match_varname(buf, "HACKDIR", 4)) { diff --git a/src/options.c b/src/options.c index 02f0f6ed0..2bc1774a2 100644 --- a/src/options.c +++ b/src/options.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)options.c 3.4 2003/10/20 */ +/* SCCS Id: @(#)options.c 3.4 2003/11/14 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2841,7 +2841,7 @@ boolean setinitial,setfromfile; if (apebuf[0] == '\033') retval = FALSE; apebuf[0] = '"'; Strcat(apebuf,"\""); - add_autopickup_exception_mapping(apebuf); + add_autopickup_exception(apebuf); } else if (opt_idx == 1) { tmpwin = create_nhwindow(NHW_TEXT); ape = iflags.autopickup_exceptions; @@ -3170,7 +3170,7 @@ dotogglepickup() #ifdef AUTOPICKUP_EXCEPTIONS int -add_autopickup_exception_mapping(mapping) +add_autopickup_exception(mapping) const char *mapping; { struct autopickup_exception *newape, *ape; @@ -3249,9 +3249,10 @@ count_ape_maps() } void -free_autopickup_exception_mappings() +free_autopickup_exceptions() { struct autopickup_exception *ape = iflags.autopickup_exceptions; + while((ape = iflags.autopickup_exceptions) != 0) { free(ape->pattern); iflags.autopickup_exceptions = ape->next; diff --git a/src/save.c b/src/save.c index d40d86455..ea101a54f 100644 --- a/src/save.c +++ b/src/save.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)save.c 3.4 2002/08/22 */ +/* SCCS Id: @(#)save.c 3.4 2003/11/14 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1109,6 +1109,7 @@ freedynamicdata() if (iflags.wc_font_menu) free(iflags.wc_font_menu); if (iflags.wc_font_status) free(iflags.wc_font_status); if (iflags.wc_tile_file) free(iflags.wc_tile_file); + free_autopickup_exceptions(); #endif /* FREE_ALL_MEMORY */ return;