From: Max Okumoto Date: Wed, 5 Jan 2005 23:28:20 +0000 (+0000) Subject: Remove cleanup functions. There is no reason to free memory X-Git-Tag: v2.0.1~9266 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/a08613bcedc0bb6324ce634e20b98a9998977b3e Remove cleanup functions. There is no reason to free memory just before exiting (especially given the number of memory leaks) - it just costs time. Taken-from: FreeBSD Author: harti --- diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c index 7db5f23e41..6c8481f6e2 100644 --- a/usr.bin/make/arch.c +++ b/usr.bin/make/arch.c @@ -37,7 +37,7 @@ * * @(#)arch.c 8.2 (Berkeley) 1/2/94 * $FreeBSD: src/usr.bin/make/arch.c,v 1.15.2.1 2001/02/13 03:13:57 will Exp $ - * $DragonFly: src/usr.bin/make/arch.c,v 1.22 2004/12/17 21:09:04 okumoto Exp $ + * $DragonFly: src/usr.bin/make/arch.c,v 1.23 2005/01/05 23:28:20 okumoto Exp $ */ /*- @@ -84,8 +84,6 @@ * is out-of-date. * * Arch_Init Initialize this module. - * - * Arch_End Cleanup this module. */ #include @@ -113,7 +111,6 @@ typedef struct Arch { size_t fnamesize; /* Size of the string table */ } Arch; -static void ArchFree(void *); static struct ar_hdr *ArchStatMember(char *, char *, Boolean); static FILE *ArchFindMember(char *, char *, struct ar_hdr *, char *); #if defined(__svr4__) || defined(__SVR4) || defined(__ELF__) @@ -121,38 +118,6 @@ static FILE *ArchFindMember(char *, char *, struct ar_hdr *, char *); static int ArchSVR4Entry(Arch *, char *, size_t, FILE *); #endif -/*- - *----------------------------------------------------------------------- - * ArchFree -- - * Free memory used by an archive - * - * Results: - * None. - * - * Side Effects: - * None. - * - *----------------------------------------------------------------------- - */ -static void -ArchFree(void *ap) -{ - Arch *a = ap; - Hash_Search search; - Hash_Entry *entry; - - /* Free memory from hash entries */ - for (entry = Hash_EnumFirst(&a->members, &search); - entry != NULL; - entry = Hash_EnumNext(&search)) - free(Hash_GetValue(entry)); - - free(a->name); - free(a->fnametab); - Hash_DeleteTable(&a->members); - free(a); -} - /*- *----------------------------------------------------------------------- * Arch_ParseArchive -- @@ -1182,23 +1147,3 @@ void Arch_Init(void) { } - -/*- - *----------------------------------------------------------------------- - * Arch_End -- - * Cleanup things for this module. - * - * Results: - * None. - * - * Side Effects: - * The 'archives' list is freed - * - *----------------------------------------------------------------------- - */ -void -Arch_End(void) -{ - - Lst_Destroy(&archives, ArchFree); -} diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c index 7faebae351..a77fd25f91 100644 --- a/usr.bin/make/dir.c +++ b/usr.bin/make/dir.c @@ -38,7 +38,7 @@ * * @(#)dir.c 8.2 (Berkeley) 1/2/94 * $$FreeBSD: src/usr.bin/make/dir.c,v 1.10.2.2 2003/10/08 08:14:22 ru Exp $ - * $DragonFly: src/usr.bin/make/dir.c,v 1.26 2004/12/17 08:13:30 okumoto Exp $ + * $DragonFly: src/usr.bin/make/dir.c,v 1.27 2005/01/05 23:28:20 okumoto Exp $ */ /*- @@ -50,8 +50,6 @@ * The interface for this module is: * Dir_Init Initialize the module. * - * Dir_End Cleanup the module. - * * Dir_HasWildcards Returns TRUE if the name given it needs to * be wildcard-expanded. * @@ -241,31 +239,6 @@ Dir_InitDot(void) dot->refCount += 1; } -/*- - *----------------------------------------------------------------------- - * Dir_End -- - * cleanup things for this module - * - * Results: - * none - * - * Side Effects: - * none - *----------------------------------------------------------------------- - */ -void -Dir_End(void) -{ - - dot->refCount -= 1; - Dir_Destroy(dot); - Dir_ClearPath(&dirSearchPath); - Lst_Destroy(&dirSearchPath, NOFREE); - Dir_ClearPath(&openDirectories); - Lst_Destroy(&openDirectories, NOFREE); - Hash_DeleteTable(&mtimes); -} - /*- *----------------------------------------------------------------------- * DirFindName -- diff --git a/usr.bin/make/dir.h b/usr.bin/make/dir.h index 1ed5ae12b1..ae15d33f20 100644 --- a/usr.bin/make/dir.h +++ b/usr.bin/make/dir.h @@ -38,7 +38,7 @@ * * from: @(#)dir.h 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.bin/make/dir.h,v 1.7 1999/08/28 01:03:29 peter Exp $ - * $DragonFly: src/usr.bin/make/dir.h,v 1.10 2004/12/17 00:02:57 okumoto Exp $ + * $DragonFly: src/usr.bin/make/dir.h,v 1.11 2005/01/05 23:28:20 okumoto Exp $ */ /* dir.h -- @@ -57,7 +57,6 @@ typedef struct Path { void Dir_Init(void); void Dir_InitDot(void); -void Dir_End(void); Boolean Dir_HasWildcards(const char *); void Dir_Expand(char *, Lst *, Lst *); char *Dir_FindFile(char *, Lst *); diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index a5989e3059..3b77cedf33 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -38,7 +38,7 @@ * @(#) Copyright (c) 1988, 1989, 1990, 1993 The Regents of the University of California. All rights reserved. * @(#)main.c 8.3 (Berkeley) 3/19/94 * $FreeBSD: src/usr.bin/make/main.c,v 1.35.2.10 2003/12/16 08:34:11 des Exp $ - * $DragonFly: src/usr.bin/make/main.c,v 1.39 2004/12/17 21:09:04 okumoto Exp $ + * $DragonFly: src/usr.bin/make/main.c,v 1.40 2005/01/05 23:28:20 okumoto Exp $ */ /*- @@ -879,14 +879,6 @@ main(int argc, char **argv) if (DEBUG(GRAPH2)) Targ_PrintGraph(2); - Suff_End(); - Targ_End(); - Arch_End(); - str_end(); - Var_End(); - Parse_End(); - Dir_End(); - if (queryFlag && outOfDate) return (1); else diff --git a/usr.bin/make/nonints.h b/usr.bin/make/nonints.h index 43f5330a93..7610d2bd5f 100644 --- a/usr.bin/make/nonints.h +++ b/usr.bin/make/nonints.h @@ -37,7 +37,7 @@ * * from: @(#)nonints.h 8.3 (Berkeley) 3/19/94 * $FreeBSD: src/usr.bin/make/nonints.h,v 1.8 1999/08/28 01:03:35 peter Exp $ - * $DragonFly: src/usr.bin/make/Attic/nonints.h,v 1.21 2004/12/17 08:13:30 okumoto Exp $ + * $DragonFly: src/usr.bin/make/Attic/nonints.h,v 1.22 2005/01/05 23:28:20 okumoto Exp $ */ /* arch.c */ @@ -49,7 +49,6 @@ int Arch_MemMTime(GNode *); void Arch_FindLib(GNode *, Lst *); Boolean Arch_LibOODate(GNode *); void Arch_Init(void); -void Arch_End(void); /* compat.c */ void Compat_Run(Lst *); @@ -87,13 +86,11 @@ void Parse_DoVar(char *, GNode *); void Parse_AddIncludeDir(char *); void Parse_File(char *, FILE *); void Parse_Init(void); -void Parse_End(void); void Parse_FromString(char *, int); void Parse_MainName(Lst *); /* str.c */ void str_init(void); -void str_end(void); char *str_concat(const char *, const char *, int); char **brk_string(char *, int *, Boolean); int Str_Match(const char *, const char *); @@ -113,12 +110,10 @@ void Suff_AddLib(char *); void Suff_FindDeps(GNode *); void Suff_SetNull(char *); void Suff_Init(void); -void Suff_End(void); void Suff_PrintAll(void); /* targ.c */ void Targ_Init(void); -void Targ_End(void); GNode *Targ_NewGN(char *); GNode *Targ_FindNode(char *, int); void Targ_FindList(Lst *, Lst *, int); @@ -144,5 +139,4 @@ char *Var_Subst(char *, char *, GNode *, Boolean); char *Var_GetTail(char *); char *Var_GetHead(char *); void Var_Init(void); -void Var_End(void); void Var_Dump(GNode *); diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index 95d1152a5f..15b7faf1e1 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -37,7 +37,7 @@ * * @(#)parse.c 8.3 (Berkeley) 3/19/94 * $FreeBSD: src/usr.bin/make/parse.c,v 1.22.2.2 2004/07/10 08:14:42 eik Exp $ - * $DragonFly: src/usr.bin/make/parse.c,v 1.28 2004/12/17 21:09:04 okumoto Exp $ + * $DragonFly: src/usr.bin/make/parse.c,v 1.29 2005/01/05 23:28:20 okumoto Exp $ */ /*- @@ -63,8 +63,6 @@ * called before anything else in this module * is used. * - * Parse_End Cleanup the module - * * Parse_File Function used to parse a makefile. It must * be given the name of the file, which should * already have been opened, and a function @@ -2528,17 +2526,6 @@ Parse_Init(void) mainNode = NULL; } -void -Parse_End(void) -{ - - Lst_Destroy(&targets, NOFREE); - Lst_Destroy(&sysIncPath, Dir_Destroy); - Lst_Destroy(&parseIncPath, Dir_Destroy); - Lst_Destroy(&includes, NOFREE); /* Should be empty now */ -} - - /*- *----------------------------------------------------------------------- * Parse_MainName -- diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c index 88fda1d54b..c156787743 100644 --- a/usr.bin/make/str.c +++ b/usr.bin/make/str.c @@ -37,7 +37,7 @@ * * @(#)str.c 5.8 (Berkeley) 6/1/90 * $FreeBSD: src/usr.bin/make/str.c,v 1.12.2.2 2004/02/23 12:10:57 ru Exp $ - * $DragonFly: src/usr.bin/make/str.c,v 1.13 2004/12/17 07:05:22 okumoto Exp $ + * $DragonFly: src/usr.bin/make/str.c,v 1.14 2005/01/05 23:28:20 okumoto Exp $ */ #include "make.h" @@ -59,24 +59,6 @@ str_init(void) argv[0] = Var_Value(".MAKE", VAR_GLOBAL, &p1); } - -/* - * str_end -- - * Cleanup the strings package - * - */ -void -str_end(void) -{ - if (argv) { - if (argv[0]) - free(argv[0]); - free(argv); - } - if (buffer) - free(buffer); -} - /*- * str_concat -- * concatenate the two strings, inserting a space or slash between them. diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c index 5779bc9d90..49648da544 100644 --- a/usr.bin/make/suff.c +++ b/usr.bin/make/suff.c @@ -37,7 +37,7 @@ * * @(#)suff.c 8.4 (Berkeley) 3/21/94 * $FreeBSD: src/usr.bin/make/suff.c,v 1.12.2.2 2004/06/10 13:07:53 ru Exp $ - * $DragonFly: src/usr.bin/make/suff.c,v 1.23 2004/12/17 21:09:04 okumoto Exp $ + * $DragonFly: src/usr.bin/make/suff.c,v 1.24 2005/01/05 23:28:20 okumoto Exp $ */ /*- @@ -48,8 +48,6 @@ * Interface: * Suff_Init Initialize all things to do with suffixes. * - * Suff_End Cleanup the module - * * Suff_DoPaths This function is used to make life easier * when searching for a file according to its * suffix. It takes the global search path, @@ -159,7 +157,6 @@ static Suff *emptySuff; /* The empty suffix required for POSIX * single-suffix transformation rules */ -static void SuffFree(void *); static void SuffInsert(Lst *, Suff *); static void SuffRemove(Lst *, Suff *); static Boolean SuffParseTransform(char *, Suff **, Suff **); @@ -338,6 +335,11 @@ SuffGNHasNameP(const void *gn, const void *name) /*********** Maintenance Functions ************/ +#if 0 +/* + * Keep this function for now until it is clear why a .SUFFIXES: doesn't + * actually delete the suffixes but just puts them on the suffClean list. + */ /*- *----------------------------------------------------------------------- * SuffFree -- @@ -369,6 +371,7 @@ SuffFree(void *sp) free(s->name); free(s); } +#endif /*- *----------------------------------------------------------------------- @@ -2243,31 +2246,6 @@ Suff_Init(void) suffNull->refCount = 1; } -/*- - *---------------------------------------------------------------------- - * Suff_End -- - * Cleanup the this module - * - * Results: - * None - * - * Side Effects: - * The memory is free'd. - *---------------------------------------------------------------------- - */ - -void -Suff_End(void) -{ - - Lst_Destroy(&sufflist, SuffFree); - Lst_Destroy(&suffClean, SuffFree); - if (suffNull) - SuffFree(suffNull); - Lst_Destroy(&srclist, NOFREE); - Lst_Destroy(&transforms, NOFREE); -} - /********************* DEBUGGING FUNCTIONS **********************/ static int diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c index affbe60fdc..bb2203957f 100644 --- a/usr.bin/make/targ.c +++ b/usr.bin/make/targ.c @@ -37,7 +37,7 @@ * * @(#)targ.c 8.2 (Berkeley) 3/19/94 * $FreeBSD: src/usr.bin/make/targ.c,v 1.10 1999/09/11 13:08:02 hoek Exp $ - * $DragonFly: src/usr.bin/make/targ.c,v 1.19 2004/12/17 08:13:30 okumoto Exp $ + * $DragonFly: src/usr.bin/make/targ.c,v 1.20 2005/01/05 23:28:20 okumoto Exp $ */ /*- @@ -49,8 +49,6 @@ * Interface: * Targ_Init Initialization procedure. * - * Targ_End Cleanup the module - * * Targ_NewGN Create a new GNode for the passed target * (string). The node is *not* placed in the * hash table, though all its fields are @@ -117,26 +115,6 @@ Targ_Init(void) Hash_InitTable(&targets, HTSIZE); } -/*- - *----------------------------------------------------------------------- - * Targ_End -- - * Finalize this module - * - * Results: - * None - * - * Side Effects: - * All lists and gnodes are cleared - *----------------------------------------------------------------------- - */ -void -Targ_End(void) -{ - - Lst_Destroy(&allTargets, NOFREE); - Hash_DeleteTable(&targets); -} - /*- *----------------------------------------------------------------------- * Targ_NewGN -- diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c index e6890c8145..8beecc58bb 100644 --- a/usr.bin/make/var.c +++ b/usr.bin/make/var.c @@ -37,7 +37,7 @@ * * @(#)var.c 8.3 (Berkeley) 3/19/94 * $FreeBSD: src/usr.bin/make/var.c,v 1.16.2.3 2002/02/27 14:18:57 cjc Exp $ - * $DragonFly: src/usr.bin/make/var.c,v 1.29 2005/01/05 20:10:40 okumoto Exp $ + * $DragonFly: src/usr.bin/make/var.c,v 1.30 2005/01/05 23:28:20 okumoto Exp $ */ /*- @@ -1939,15 +1939,8 @@ Var_Init(void) VAR_GLOBAL = Targ_NewGN("Global"); VAR_CMD = Targ_NewGN("Command"); - -} - -void -Var_End(void) -{ } - /****************** PRINT DEBUGGING INFO *****************/ static int VarPrintVar(void *vp, void *dummy __unused)