=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/targ.c,v retrieving revision 1.36 retrieving revision 1.37 diff -c -r1.36 -r1.37 *** src/usr.bin/make/targ.c 2002/12/29 17:20:17 1.36 --- src/usr.bin/make/targ.c 2003/01/03 17:44:48 1.37 *************** *** 1,5 **** /* $OpenPackages$ */ ! /* $OpenBSD: targ.c,v 1.36 2002/12/29 17:20:17 espie Exp $ */ /* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */ /* --- 1,5 ---- /* $OpenPackages$ */ ! /* $OpenBSD: targ.c,v 1.37 2003/01/03 17:44:48 espie Exp $ */ /* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */ /* *************** *** 119,124 **** --- 119,127 ---- #include "extern.h" #include "timestamp.h" #include "lst.h" + #ifdef CLEANUP + #include + #endif static struct ohash targets; /* a hash table of same */ static struct ohash_info gnode_info = { *************** *** 129,134 **** --- 132,138 ---- static void TargPrintName(void *); static void TargPrintNode(GNode *, int); #ifdef CLEANUP + static LIST allTargets; static void TargFreeGN(void *); #endif *************** *** 146,151 **** --- 150,158 ---- { /* A small make file already creates 200 targets. */ ohash_init(&targets, 10, &gnode_info); + #ifdef CLEANUP + Lst_Init(&allTargets); + #endif } /*- *************** *** 161,172 **** void Targ_End() { ! unsigned int i; ! GNode *n; ! ! for (n = ohash_first(&targets, &i); n != NULL; n = ohash_next(&targets, &i)) ! TargFreeGN(n); ! ohash_delete(&targets); } #endif --- 168,174 ---- void Targ_End() { ! Lst_Every(&allTargets, TargFreeGN); ohash_delete(&targets); } #endif *************** *** 180,185 **** --- 182,189 ---- * An initialized graph node with the name field filled with a copy * of the passed name * + * Side effect: + * add targets to list of all targets if CLEANUP *----------------------------------------------------------------------- */ GNode * *************** *** 219,224 **** --- 223,231 ---- STAT_GN_COUNT++; #endif + #ifdef CLEANUP + Lst_AtEnd(&allTargets, gn); + #endif return gn; }