summaryrefslogtreecommitdiff
path: root/expand.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2006-03-15 03:31:30 +0000
committerPaul Smith <psmith@gnu.org>2006-03-15 03:31:30 +0000
commit50eb3cf5e5a8a68b68e966a6607f668f2c36191e (patch)
tree8665fbf1e101e681967fbfea570d09bbe6f3ab54 /expand.c
parent6d8d9b74d9c50cb07fe952ac0929f618e4280a55 (diff)
downloadgunmake-50eb3cf5e5a8a68b68e966a6607f668f2c36191e.tar.gz
Fix Savannah bug #15913.
Diffstat (limited to 'expand.c')
-rw-r--r--expand.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/expand.c b/expand.c
index 5c7934e..993e6d4 100644
--- a/expand.c
+++ b/expand.c
@@ -501,14 +501,19 @@ variable_append (const char *name, unsigned int length,
if (buf > variable_buffer)
buf = variable_buffer_output (buf, " ", 1);
- return variable_buffer_output (buf, v->value, strlen (v->value));
+ /* Either expand it or copy it, depending. */
+ if (! v->recursive)
+ return variable_buffer_output (buf, v->value, strlen (v->value));
+
+ buf = variable_expand_string (buf, v->value, strlen (v->value));
+ return (buf + strlen (buf));
}
static char *
allocated_variable_append (const struct variable *v)
{
- char *val, *retval;
+ char *val;
/* Construct the appended variable value. */
@@ -524,12 +529,7 @@ allocated_variable_append (const struct variable *v)
variable_buffer = obuf;
variable_buffer_length = olen;
- /* Now expand it and return that. */
-
- retval = allocated_variable_expand (val);
-
- free (val);
- return retval;
+ return val;
}
/* Like variable_expand_for_file, but the returned string is malloc'd.