summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2020-02-19 17:39:13 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2020-04-29 16:04:17 +1000
commitecd82629d6115036b1f89410a0964d251527c4ca (patch)
tree35770948ea1882a5c8c99d8ce58c6ffd8dc90008 /src
parentjobs: Rename DOWAIT_NORMAL to DOWAIT_NONBLOCK (diff)
downloaddash-ecd82629d6115036b1f89410a0964d251527c4ca.tar.gz
dash-ecd82629d6115036b1f89410a0964d251527c4ca.zip
var: Remove poplocalvars() always-zero argument, make it static
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'src')
-rw-r--r--src/var.c24
-rw-r--r--src/var.h1
2 files changed, 4 insertions, 21 deletions
diff --git a/src/var.c b/src/var.c
index 0d7e1db..b146018 100644
--- a/src/var.c
+++ b/src/var.c
@@ -504,8 +504,8 @@ void mklocal(char *name, int flags)
  * Interrupts must be off.
  */
 
-void
-poplocalvars(int keep)
+static void
+poplocalvars(void)
 {
 	struct localvar_list *ll;
 	struct localvar *lvp, *next;
@@ -522,23 +522,7 @@ poplocalvars(int keep)
 		next = lvp->next;
 		vp = lvp->vp;
 		TRACE(("poplocalvar %s\n", vp ? vp->text : "-"));
-		if (keep) {
-			int bits = VSTRFIXED;
-
-			if (lvp->flags != VUNSET) {
-				if (vp->text == lvp->text)
-					bits |= VTEXTFIXED;
-				else if (!(lvp->flags & (VTEXTFIXED|VSTACK)))
-					ckfree(lvp->text);
-			}
-
-			vp->flags &= ~bits;
-			vp->flags |= (lvp->flags & bits);
-
-			if ((vp->flags &
-			     (VEXPORT|VREADONLY|VSTRFIXED|VUNSET)) == VUNSET)
-				unsetvar(vp->text);
-		} else if (vp == NULL) {	/* $- saved */
+		if (vp == NULL) {	/* $- saved */
 			memcpy(optlist, lvp->text, sizeof(optlist));
 			ckfree(lvp->text);
 			optschanged();
@@ -586,7 +570,7 @@ out:
 void unwindlocalvars(struct localvar_list *stop)
 {
 	while (localvar_stack != stop)
-		poplocalvars(0);
+		poplocalvars();
 }
 
 
diff --git a/src/var.h b/src/var.h
index cd0477f..aa7575a 100644
--- a/src/var.h
+++ b/src/var.h
@@ -148,7 +148,6 @@ int exportcmd(int, char **);
 int localcmd(int, char **);
 void mklocal(char *name, int flags);
 struct localvar_list *pushlocalvars(int push);
-void poplocalvars(int);
 void unwindlocalvars(struct localvar_list *stop);
 int unsetcmd(int, char **);
 void unsetvar(const char *);