From 0afbbf8595b6035a5a930399d20320d2e2852d72 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Thu, 24 Sep 2009 02:41:44 +0000 Subject: - Rework secondary expansion so we only defer it if there's a possibility it might be needed: for most situations we parse prereqs immediately as we used to. Reduces memory usage. - Fixes Savannah bug #18622. --- commands.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'commands.c') diff --git a/commands.c b/commands.c index 94c4867..d9d7f53 100644 --- a/commands.c +++ b/commands.c @@ -116,7 +116,8 @@ set_file_variables (struct file *file) for (d = file->deps; d != 0; d = d->next) if (!d->ignore_mtime) { - less = dep_name (d); + if (!d->need_2nd_expansion) + less = dep_name (d); break; } @@ -153,7 +154,7 @@ set_file_variables (struct file *file) plus_len = 0; for (d = file->deps; d != 0; d = d->next) - if (! d->ignore_mtime) + if (! d->ignore_mtime && ! d->need_2nd_expansion) plus_len += strlen (dep_name (d)) + 1; if (plus_len == 0) plus_len++; @@ -164,7 +165,7 @@ set_file_variables (struct file *file) qmark_len = plus_len + 1; /* Will be this or less. */ for (d = file->deps; d != 0; d = d->next) - if (! d->ignore_mtime) + if (! d->ignore_mtime && ! d->need_2nd_expansion) { const char *c = dep_name (d); @@ -198,7 +199,7 @@ set_file_variables (struct file *file) bar_len = 0; for (d = file->deps; d != 0; d = d->next) - if (d->ignore_mtime) + if (d->ignore_mtime && ! d->need_2nd_expansion) bar_len += strlen (dep_name (d)) + 1; if (bar_len == 0) bar_len++; @@ -217,8 +218,12 @@ set_file_variables (struct file *file) for (d = file->deps; d != 0; d = d->next) { - const char *c = dep_name (d); + const char *c; + if (d->need_2nd_expansion) + continue; + + c = dep_name (d); #ifndef NO_ARCHIVES if (ar_name (c)) { -- cgit v1.2.3