]> git.ozlabs.org Git - petitboot/commit
discover/grub2: Perform word-expansion non-destructively
authorJeremy Kerr <jk@ozlabs.org>
Tue, 28 Jan 2014 01:38:13 +0000 (09:38 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 30 Jan 2014 13:59:10 +0000 (21:59 +0800)
commite1b713b0c862a93cd3e8cea59070f469510d3c39
tree5ecf37fb48e32e9704c72f0631e1d5d72715ba7c
parent4896183708855fbfd0aa892537fbcc17ed7eb971
discover/grub2: Perform word-expansion non-destructively

In order to implement for-loops, we may need to evaluate the same chunk
of script more than once, and perform that evaluation in a different
context (particularly, with different environment variables).

Currently, the process_expansion code destroys the result of the
parse-tree (ie, the token list) when performing expansions. This means
that we can only perform the expansions once.

This change preserves the token list while creating the argv array. This
means that we can expand the list multiple times.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/grub2/script.c