summaryrefslogtreecommitdiff
path: root/commands.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2007-03-20 03:02:26 +0000
committerPaul Smith <psmith@gnu.org>2007-03-20 03:02:26 +0000
commit6ccf33cdbdfda2aea5d51e4d4991881c74d853d1 (patch)
treece963770c6d0dc0428a6bce65d96da4b710e2831 /commands.c
parente4da30858037b431880263676e8f90b1f8412a38 (diff)
downloadgunmake-6ccf33cdbdfda2aea5d51e4d4991881c74d853d1.tar.gz
This is a major update, which switches virtually every allocated-but-not-freed
string into the strcache. As a side-effect, many more structure members and function arguments can/should be declared const. As mentioned in the changelog, unfortunately measurement shows that this change does not yet reduce memory. The problem is with secondary expansion: because of this we store all the prerequisites in the string cache twice. First we store the prerequisite string after initial expansion but before secondary expansion, then we store each individual file after secondary expansion and expand_deps(). I plan to change expand_deps() to be callable in either context (eval or snap_deps) then have non-second-expansion targets call expand_deps() during eval, so that we only need to store that dependency list once.
Diffstat (limited to 'commands.c')
-rw-r--r--commands.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/commands.c b/commands.c
index d1db6fe..246fe28 100644
--- a/commands.c
+++ b/commands.c
@@ -97,12 +97,12 @@ set_file_variables (struct file *file)
len = strlen (name);
}
- for (d = enter_file (".SUFFIXES")->deps; d != 0; d = d->next)
+ for (d = enter_file (strcache_add (".SUFFIXES"))->deps; d ; d = d->next)
{
unsigned int slen = strlen (dep_name (d));
if (len > slen && strneq (dep_name (d), name + (len - slen), slen))
{
- file->stem = savestring (name, len - slen);
+ file->stem = strcache_add_len (name, len - slen);
break;
}
}