}
/* Now allocate a buffer big enough and fill it. */
- p = value = alloca (len);
+ p = value = xmalloc (len);
for (cv = command_variables; cv != 0; cv = cv->next)
{
v = cv->variable;
/* Define an unchangeable variable with a name that no POSIX.2
makefile could validly use for its own variable. */
define_variable_cname ("-*-command-variables-*-", value, o_automatic, 0);
+ free (value);
/* Define the variable; this will not override any user definition.
Normally a reference to this variable is written into the value of
free (p);
}
- p = endp = value = alloca (len);
+ p = endp = value = xmalloc (len);
for (i = 0; i < eval_strings->idx; ++i)
{
p = stpcpy (p, "--eval=");
*endp = '\0';
define_variable_cname ("-*-eval-flags-*-", value, o_automatic, 0);
+ free (value);
}
{
if (len == 0)
return;
- /* Allocate a vector that is definitely big enough. */
- argv = alloca ((1 + len + 1) * sizeof (char *));
+ /* Allocate an array that is definitely big enough. */
+ argv = xmalloc ((1 + len + 1) * sizeof (char *));
/* getopt will look at the arguments starting at ARGV[1].
Prepend a spacer word. */
/* We need a buffer to copy the value into while we split it into words
and unquote it. Set up in case we need to prepend a dash later. */
- buf = alloca (1 + len + 1);
+ buf = xmalloc (1 + len + 1);
buf[0] = '-';
p = buf+1;
argv[argc] = p;
/* Parse those words. */
decode_switches (argc, argv, origin);
+ free (buf);
+ free (argv);
}
\f
/* Quote the string IN so that it will be interpreted as a single word with
# 200 is the initial size of variable_buffer.
# Value bigger than 200 bytes causes a realloc of variable_buffer.
# In this test the variable being expanded is MAKEFLAGS and its value occupies
-# 11, 550 and 110000 bytes.
+# 12, 600 and 120000 bytes.
-my $s = "hello_world";
+my $s = "hello_world\n";
my @mult = (1, 50, 10000);
for my $m (@mult) {