=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/parse.c,v retrieving revision 1.37 retrieving revision 1.38 diff -c -r1.37 -r1.38 *** src/usr.bin/make/parse.c 2000/03/26 16:21:32 1.37 --- src/usr.bin/make/parse.c 2000/04/17 23:45:24 1.38 *************** *** 1,4 **** ! /* $OpenBSD: parse.c,v 1.37 2000/03/26 16:21:32 espie Exp $ */ /* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: parse.c,v 1.38 2000/04/17 23:45:24 espie Exp $ */ /* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */ /* *************** *** 43,49 **** #if 0 static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; #else ! static char rcsid[] = "$OpenBSD: parse.c,v 1.37 2000/03/26 16:21:32 espie Exp $"; #endif #endif /* not lint */ --- 43,49 ---- #if 0 static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; #else ! static char rcsid[] = "$OpenBSD: parse.c,v 1.38 2000/04/17 23:45:24 espie Exp $"; #endif #endif /* not lint */ *************** *** 104,109 **** --- 104,113 ---- #include "buf.h" #include "pathnames.h" + #ifdef CLEANUP + static Lst fileNames; /* file names to free at end */ + #endif + /* * These values are returned by ParseEOF to tell Parse_File whether to * CONTINUE parsing, i.e. it had only reached the end of an include file, *************** *** 1808,1813 **** --- 1812,1820 ---- * place. Naturally enough, we start reading at line number 0. */ fname = fullname; + #ifdef CLEANUP + Lst_AtEnd(fileNames, fname); + #endif lineno = 0; curFILE = fopen (fullname, "r"); *************** *** 1857,1863 **** curPTR = (PTR *) emalloc (sizeof (PTR)); curPTR->str = curPTR->ptr = str; lineno = newlineno; - fname = estrdup(fname); } --- 1864,1869 ---- *************** *** 1991,1996 **** --- 1997,2005 ---- * place. Naturally enough, we start reading at line number 0. */ fname = fullname; + #ifdef CLEANUP + lst_AtEnd(fileNames, fname); + #endif lineno = 0; curFILE = fopen (fullname, "r"); *************** *** 2028,2034 **** if ((ifile = (IFile *)Lst_DeQueue(includes)) == NULL) return DONE; - free ((Address) fname); fname = ifile->fname; lineno = ifile->lineno; if (opened && curFILE) --- 2037,2042 ---- *************** *** 2455,2461 **** *line; /* the line we're working on */ inLine = FALSE; ! fname = name; curFILE = stream; lineno = 0; fatals = 0; --- 2463,2472 ---- *line; /* the line we're working on */ inLine = FALSE; ! fname = estrdup(name); ! #ifdef CLEANUP ! Lst_AtEnd(fileNames, fname); ! #endif curFILE = stream; lineno = 0; fatals = 0; *************** *** 2641,2646 **** --- 2652,2658 ---- includes = Lst_Init(); #ifdef CLEANUP targCmds = Lst_Init(); + fileNames = Lst_Init(); #endif } *************** *** 2649,2654 **** --- 2661,2667 ---- { #ifdef CLEANUP Lst_Destroy(targCmds, (void (*) __P((ClientData))) free); + Lst_Destroy(fileNames, (void (*) __P((ClientData))) free); if (targets) Lst_Destroy(targets, NOFREE); Lst_Destroy(sysIncPath, Dir_Destroy); *************** *** 2695,2699 **** --- 2708,2718 ---- Parse_Getlineno() { return lineno; + } + + const char * + Parse_Getfilename() + { + return fname; }