summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2004-12-17 13:20:19 +0000
committerharti <harti@FreeBSD.org>2004-12-17 13:20:19 +0000
commitebeffbcdeb1dbe7f6784d8aa322bbba797e7b07c (patch)
tree6eb76b042b6e1af4a0e99fe9fd18b8086748cbe0
parentfbe42b3f98a3d07f38177307459c6bfaeca73aef (diff)
downloadFreeBSD-src-ebeffbcdeb1dbe7f6784d8aa322bbba797e7b07c.zip
FreeBSD-src-ebeffbcdeb1dbe7f6784d8aa322bbba797e7b07c.tar.gz
Remove all the cleanup functions. There is no reason to free memory
just before exiting (especially given the number of memory leaks) - it just costs time.
-rw-r--r--usr.bin/make/arch.c55
-rw-r--r--usr.bin/make/dir.c27
-rw-r--r--usr.bin/make/dir.h1
-rw-r--r--usr.bin/make/main.c8
-rw-r--r--usr.bin/make/nonints.h6
-rw-r--r--usr.bin/make/parse.c13
-rw-r--r--usr.bin/make/str.c18
-rw-r--r--usr.bin/make/suff.c34
-rw-r--r--usr.bin/make/targ.c22
-rw-r--r--usr.bin/make/var.c7
10 files changed, 6 insertions, 185 deletions
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c
index 6947acc..17def65 100644
--- a/usr.bin/make/arch.c
+++ b/usr.bin/make/arch.c
@@ -85,8 +85,6 @@ __FBSDID("$FreeBSD$");
* is out-of-date.
*
* Arch_Init Initialize this module.
- *
- * Arch_End Cleanup this module.
*/
#include <sys/types.h>
@@ -114,7 +112,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__)
@@ -124,38 +121,6 @@ static int ArchSVR4Entry(Arch *, char *, size_t, FILE *);
/*-
*-----------------------------------------------------------------------
- * 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 --
* Parse the archive specification in the given line and find/create
* the nodes for the specified archive members, placing their nodes
@@ -1184,23 +1149,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 c353629..6734b67 100644
--- a/usr.bin/make/dir.c
+++ b/usr.bin/make/dir.c
@@ -51,8 +51,6 @@ __FBSDID("$FreeBSD$");
* 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.
*
@@ -244,31 +242,6 @@ Dir_InitDot(void)
/*-
*-----------------------------------------------------------------------
- * 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 --
* See if the Path structure describes the same directory as the
* given one by comparing their names. Called from Dir_AddDir via
diff --git a/usr.bin/make/dir.h b/usr.bin/make/dir.h
index bd37f99..4287f21 100644
--- a/usr.bin/make/dir.h
+++ b/usr.bin/make/dir.h
@@ -56,7 +56,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 8de4d1f..2c3ba65 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -885,14 +885,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 aa73f6a..cc64313 100644
--- a/usr.bin/make/nonints.h
+++ b/usr.bin/make/nonints.h
@@ -48,7 +48,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 *);
@@ -86,13 +85,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 *);
@@ -112,12 +109,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);
@@ -142,5 +137,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 4aa3313..b9c8c05 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -64,8 +64,6 @@ __FBSDID("$FreeBSD$");
* 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
@@ -2522,17 +2520,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 4cbd488..2979906 100644
--- a/usr.bin/make/str.c
+++ b/usr.bin/make/str.c
@@ -60,24 +60,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 25b6dbf..dce4bca 100644
--- a/usr.bin/make/suff.c
+++ b/usr.bin/make/suff.c
@@ -49,8 +49,6 @@ __FBSDID("$FreeBSD$");
* 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,
@@ -160,7 +158,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 **);
@@ -339,6 +336,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 --
@@ -370,6 +372,7 @@ SuffFree(void *sp)
free(s->name);
free(s);
}
+#endif
/*-
*-----------------------------------------------------------------------
@@ -2244,31 +2247,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 eff08ee..cce8bcc 100644
--- a/usr.bin/make/targ.c
+++ b/usr.bin/make/targ.c
@@ -50,8 +50,6 @@ __FBSDID("$FreeBSD$");
* 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
@@ -120,26 +118,6 @@ Targ_Init(void)
/*-
*-----------------------------------------------------------------------
- * 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 --
* Create and initialize a new graph node
*
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index d0eb74a..a136d01 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1920,15 +1920,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)
OpenPOWER on IntegriCloud