diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2018-05-31 01:15:34 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-08-29 11:16:09 +0800 |
commit | 42298df5898a62f0df893be3af029d7e981623bd (patch) | |
tree | 5b9a00e582702d055b00fddaf83b6d9ad804ffd7 /src/var.c | |
parent | expand: Do not reprocess data when expanding words (diff) | |
download | dash-42298df5898a62f0df893be3af029d7e981623bd.tar.gz dash-42298df5898a62f0df893be3af029d7e981623bd.zip |
eval: Always set localvar_stop
The variable localvar_stop is set iff vlocal is true. gcc doesn't get this so we get a spurious warning. This patch fixes this by always calling pushlocalvars with vlocal and making it only actually do the push if vlocal is non-zero. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r-- | src/var.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/var.c b/src/var.c index 40743e5..0d7e1db 100644 --- a/src/var.c +++ b/src/var.c @@ -562,18 +562,24 @@ poplocalvars(int keep) /* * Create a new localvar environment. */ -struct localvar_list *pushlocalvars(void) +struct localvar_list *pushlocalvars(int push) { struct localvar_list *ll; + struct localvar_list *top; + + top = localvar_stack; + if (!push) + goto out; INTOFF; ll = ckmalloc(sizeof(*ll)); ll->lv = NULL; - ll->next = localvar_stack; + ll->next = top; localvar_stack = ll; INTON; - return ll->next; +out: + return top; } |