diff options
author | Marc Espie <espie@cvs.openbsd.org> | 1999-10-05 22:06:25 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 1999-10-05 22:06:25 +0000 |
commit | cc4cf4da2b448e948d520e8013e95acd09405205 (patch) | |
tree | 84c3d829f948745b1569ed8aa93944be482f828b /usr.bin | |
parent | 586b5707cecbb5ef0358c451e69ab50979cdab68 (diff) |
Efficiency patch from NetBSD:
make spends time freeing data structures right before exiting.
So don't bother.
Keep the code inside #ifdef, so that it's still there if someone
ever wants to use make code inside a library.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/make/arch.c | 10 | ||||
-rw-r--r-- | usr.bin/make/dir.c | 6 | ||||
-rw-r--r-- | usr.bin/make/job.c | 6 | ||||
-rw-r--r-- | usr.bin/make/parse.c | 12 | ||||
-rw-r--r-- | usr.bin/make/suff.c | 12 | ||||
-rw-r--r-- | usr.bin/make/targ.c | 14 |
6 files changed, 48 insertions, 12 deletions
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c index 81f75a9bc6b..af3d90f1705 100644 --- a/usr.bin/make/arch.c +++ b/usr.bin/make/arch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arch.c,v 1.15 1999/06/01 17:54:31 pefo Exp $ */ +/* $OpenBSD: arch.c,v 1.16 1999/10/05 22:06:23 espie Exp $ */ /* $NetBSD: arch.c,v 1.17 1996/11/06 17:58:59 christos Exp $ */ /* @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; #else -static char rcsid[] = "$OpenBSD: arch.c,v 1.15 1999/06/01 17:54:31 pefo Exp $"; +static char rcsid[] = "$OpenBSD: arch.c,v 1.16 1999/10/05 22:06:23 espie Exp $"; #endif #endif /* not lint */ @@ -130,7 +130,9 @@ typedef struct Arch { } Arch; static int ArchFindArchive __P((ClientData, ClientData)); +#ifdef CLEANUP static void ArchFree __P((ClientData)); +#endif static struct ar_hdr *ArchStatMember __P((char *, char *, Boolean)); static FILE *ArchFindMember __P((char *, char *, struct ar_hdr *, char *)); #if defined(__svr4__) || defined(__SVR4) || \ @@ -140,6 +142,7 @@ static FILE *ArchFindMember __P((char *, char *, struct ar_hdr *, char *)); static int ArchSVR4Entry __P((Arch *, char *, size_t, FILE *)); #endif +#ifdef CLEANUP /*- *----------------------------------------------------------------------- * ArchFree -- @@ -172,6 +175,7 @@ ArchFree(ap) Hash_DeleteTable(&a->members); free((Address) a); } +#endif @@ -1245,7 +1249,9 @@ Arch_Init () void Arch_End () { +#ifdef CLEANUP Lst_Destroy(archives, ArchFree); +#endif } /*- diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c index 86c7eaa218c..6bcd0f7b734 100644 --- a/usr.bin/make/dir.c +++ b/usr.bin/make/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.8 1998/12/05 00:06:27 espie Exp $ */ +/* $OpenBSD: dir.c,v 1.9 1999/10/05 22:06:23 espie Exp $ */ /* $NetBSD: dir.c,v 1.14 1997/03/29 16:51:26 christos Exp $ */ /* @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; #else -static char rcsid[] = "$OpenBSD: dir.c,v 1.8 1998/12/05 00:06:27 espie Exp $"; +static char rcsid[] = "$OpenBSD: dir.c,v 1.9 1999/10/05 22:06:23 espie Exp $"; #endif #endif /* not lint */ @@ -250,6 +250,7 @@ Dir_Init () void Dir_End() { +#ifdef CLEANUP dot->refCount -= 1; Dir_Destroy((ClientData) dot); Dir_ClearPath(dirSearchPath); @@ -257,6 +258,7 @@ Dir_End() Dir_ClearPath(openDirectories); Lst_Destroy(openDirectories, NOFREE); Hash_DeleteTable(&mtimes); +#endif } /*- diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index 175c5f412fa..40c42882ae8 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -1,4 +1,4 @@ -/* $OpenBSD: job.c,v 1.12 1998/12/05 00:06:27 espie Exp $ */ +/* $OpenBSD: job.c,v 1.13 1999/10/05 22:06:24 espie Exp $ */ /* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */ /* @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -static char rcsid[] = "$OpenBSD: job.c,v 1.12 1998/12/05 00:06:27 espie Exp $"; +static char rcsid[] = "$OpenBSD: job.c,v 1.13 1999/10/05 22:06:24 espie Exp $"; #endif #endif /* not lint */ @@ -2991,7 +2991,9 @@ Job_Finish() void Job_End() { +#ifdef CLEANUP efree(shellArgv); +#endif } /*- diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index c148591d5e3..ac75b329eed 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.19 1999/05/04 16:44:45 millert Exp $ */ +/* $OpenBSD: parse.c,v 1.20 1999/10/05 22:06:24 espie Exp $ */ /* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */ /* @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; #else -static char rcsid[] = "$OpenBSD: parse.c,v 1.19 1999/05/04 16:44:45 millert Exp $"; +static char rcsid[] = "$OpenBSD: parse.c,v 1.20 1999/10/05 22:06:24 espie Exp $"; #endif #endif /* not lint */ @@ -112,7 +112,9 @@ static char rcsid[] = "$OpenBSD: parse.c,v 1.19 1999/05/04 16:44:45 millert Exp #define CONTINUE 1 #define DONE 0 static Lst targets; /* targets we're working on */ +#ifdef CLEANUP static Lst targCmds; /* command lines for targets */ +#endif static Boolean inLine; /* true if currently in a dependency * line or its commands */ typedef struct { @@ -2514,7 +2516,9 @@ Parse_File(name, stream) * commands of all targets in the dependency spec */ Lst_ForEach (targets, ParseAddCmd, cp); +#ifdef CLEANUP Lst_AtEnd(targCmds, (ClientData) line); +#endif continue; } else { Parse_Error (PARSE_FATAL, @@ -2637,18 +2641,22 @@ Parse_Init () parseIncPath = Lst_Init (FALSE); sysIncPath = Lst_Init (FALSE); includes = Lst_Init (FALSE); +#ifdef CLEANUP targCmds = Lst_Init (FALSE); +#endif } void Parse_End() { +#ifdef CLEANUP Lst_Destroy(targCmds, (void (*) __P((ClientData))) free); if (targets) Lst_Destroy(targets, NOFREE); Lst_Destroy(sysIncPath, Dir_Destroy); Lst_Destroy(parseIncPath, Dir_Destroy); Lst_Destroy(includes, NOFREE); /* Should be empty now */ +#endif } diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c index bcf8bb7ab08..cba847e3103 100644 --- a/usr.bin/make/suff.c +++ b/usr.bin/make/suff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: suff.c,v 1.13 1999/03/06 20:27:40 millert Exp $ */ +/* $OpenBSD: suff.c,v 1.14 1999/10/05 22:06:24 espie Exp $ */ /* $NetBSD: suff.c,v 1.13 1996/11/06 17:59:25 christos Exp $ */ /* @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94"; #else -static char rcsid[] = "$OpenBSD: suff.c,v 1.13 1999/03/06 20:27:40 millert Exp $"; +static char rcsid[] = "$OpenBSD: suff.c,v 1.14 1999/10/05 22:06:24 espie Exp $"; #endif #endif /* not lint */ @@ -104,7 +104,9 @@ static char rcsid[] = "$OpenBSD: suff.c,v 1.13 1999/03/06 20:27:40 millert Exp $ #include "dir.h" static Lst sufflist; /* Lst of suffixes */ +#ifdef CLEANUP static Lst suffClean; /* Lst of suffixes to be cleaned */ +#endif static Lst srclist; /* Lst of sources */ static Lst transforms; /* Lst of transformation rules */ @@ -487,7 +489,9 @@ SuffInsert (l, s) void Suff_ClearSuffixes () { +#ifdef CLEANUP Lst_Concat (suffClean, sufflist, LST_CONCLINK); +#endif sufflist = Lst_Init(FALSE); sNum = 0; suffNull = emptySuff; @@ -2334,7 +2338,9 @@ void Suff_Init () { sufflist = Lst_Init (FALSE); +#ifdef CLEANUP suffClean = Lst_Init(FALSE); +#endif srclist = Lst_Init (FALSE); transforms = Lst_Init (FALSE); @@ -2376,12 +2382,14 @@ Suff_Init () void Suff_End() { +#ifdef CLEANUP Lst_Destroy(sufflist, SuffFree); Lst_Destroy(suffClean, SuffFree); if (suffNull) SuffFree(suffNull); Lst_Destroy(srclist, NOFREE); Lst_Destroy(transforms, NOFREE); +#endif } diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c index 469896d4871..a8132c05a42 100644 --- a/usr.bin/make/targ.c +++ b/usr.bin/make/targ.c @@ -1,4 +1,4 @@ -/* $OpenBSD: targ.c,v 1.9 1998/12/05 00:06:29 espie Exp $ */ +/* $OpenBSD: targ.c,v 1.10 1999/10/05 22:06:24 espie Exp $ */ /* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */ /* @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94"; #else -static char *rcsid = "$OpenBSD: targ.c,v 1.9 1998/12/05 00:06:29 espie Exp $"; +static char *rcsid = "$OpenBSD: targ.c,v 1.10 1999/10/05 22:06:24 espie Exp $"; #endif #endif /* not lint */ @@ -95,7 +95,9 @@ static char *rcsid = "$OpenBSD: targ.c,v 1.9 1998/12/05 00:06:29 espie Exp $"; #include "dir.h" static Lst allTargets; /* the list of all targets found so far */ +#ifdef CLEANUP static Lst allGNs; /* List of all the GNodes */ +#endif static Hash_Table targets; /* a hash table of same */ #define HTSIZE 191 /* initial size of hash table */ @@ -103,7 +105,9 @@ static Hash_Table targets; /* a hash table of same */ static int TargPrintOnlySrc __P((ClientData, ClientData)); static int TargPrintName __P((ClientData, ClientData)); static int TargPrintNode __P((ClientData, ClientData)); +#ifdef CLEANUP static void TargFreeGN __P((ClientData)); +#endif /*- *----------------------------------------------------------------------- @@ -139,10 +143,12 @@ Targ_Init () void Targ_End () { +#ifdef CLEANUP Lst_Destroy(allTargets, NOFREE); if (allGNs) Lst_Destroy(allGNs, TargFreeGN); Hash_DeleteTable(&targets); +#endif } /*- @@ -188,13 +194,16 @@ Targ_NewGN (name) gn->commands = Lst_Init (FALSE); gn->suffix = NULL; +#ifdef CLEANUP if (allGNs == NULL) allGNs = Lst_Init(FALSE); Lst_AtEnd(allGNs, (ClientData) gn); +#endif return (gn); } +#ifdef CLEANUP /*- *----------------------------------------------------------------------- * TargFreeGN -- @@ -227,6 +236,7 @@ TargFreeGN (gnp) Lst_Destroy(gn->commands, NOFREE); free((Address)gn); } +#endif /*- |