summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2005-10-24 13:01:39 +0000
committerPaul Smith <psmith@gnu.org>2005-10-24 13:01:39 +0000
commit11095a90f120545c915c92b8ebf48f04723d1837 (patch)
tree73dba88903ea90cdac930057fe8619a8a04fb869 /misc.c
parent66459baee27374577d32a78564604ad64228f71d (diff)
downloadgunmake-11095a90f120545c915c92b8ebf48f04723d1837.tar.gz
Make second expansion optional (partial implementation).
I decided this feature was too impacting to make the permanent default behavior. This set of changes makes the default behavior of make the old behavior (no second expansion). If you want second expansion, you must define the .SECONDEXPANSION: special target before the first target that needs it. This set of changes ONLY fixes explicit and static pattern rules to work like this. Implicit rules still have second expansion enabled all the time: I'll work on that next. Note that there is still a backward-incompatibility: now to get the old SysV behavior using $$@ etc. in the prerequisites list you need to set .SECONDEXPANSION: as well.
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/misc.c b/misc.c
index ac50270..6f12683 100644
--- a/misc.c
+++ b/misc.c
@@ -485,7 +485,7 @@ find_next_token (char **ptr, unsigned int *lengthptr)
with the same contents as the old one. */
struct dep *
-copy_dep_chain (struct dep *d)
+copy_dep_chain (const struct dep *d)
{
register struct dep *c;
struct dep *firstnew = 0;
@@ -508,6 +508,21 @@ copy_dep_chain (struct dep *d)
return firstnew;
}
+
+/* Free a chain of 'struct dep'. */
+
+void
+free_dep_chain (struct dep *d)
+{
+ while (d != 0)
+ {
+ struct dep *df = d;
+ d = d->next;
+
+ free (df->name);
+ free ((char *)df);
+ }
+}
/* Free a chain of `struct nameseq'. Each nameseq->name is freed
as well. Can be used on `struct dep' chains.*/