* src/function.c (func_let): Don't edit nonexistent values

* tests/scripts/functions/let: Test trailing whitespace in value list.
This commit is contained in:
Jouke Witteveen 2024-01-01 19:27:44 -05:00 committed by Paul Smith
parent dd1980426e
commit 89bea82af3
2 changed files with 6 additions and 6 deletions

View File

@ -915,8 +915,6 @@ func_let (char *o, char **argv, const char *funcname UNUSED)
const char *vp;
const char *vp_next = varnames;
const char *list_iterator = list;
char *p;
size_t len;
size_t vlen;
push_new_variable_scope ();
@ -926,8 +924,9 @@ func_let (char *o, char **argv, const char *funcname UNUSED)
NEXT_TOKEN (vp_next);
while (*vp_next != '\0')
{
p = find_next_token (&list_iterator, &len);
if (*list_iterator != '\0')
size_t len;
char *p = find_next_token (&list_iterator, &len);
if (p && *list_iterator != '\0')
{
++list_iterator;
p[len] = '\0';

View File

@ -42,9 +42,10 @@ null =
v = $(let ,$(info blankvar),abc)
x = $(let $(null),$(info side-effect),abc)
y = $(let y,,$ydef)
z = $(let a b, ,+$a+$b+)
all: ; @echo $v/$x/$y',
'', "blankvar\nside-effect\nabc/abc/def\n");
all: ; @echo $v/$x/$y/$z',
'', "blankvar\nside-effect\nabc/abc/def/+++\n");
# The example macro from the manual.
run_make_test('