dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denys Vlasenko <dvlasenk@redhat.com>
To: Herbert Xu <herbert@gondor.apana.org.au>, dash@vger.kernel.org
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Subject: [PATCH] Remove poplocalvars() always-zero argument, make it static
Date: Wed, 19 Feb 2020 17:39:13 +0100	[thread overview]
Message-ID: <20200219163913.11951-1-dvlasenk@redhat.com> (raw)

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
---
 src/var.c | 24 ++++--------------------
 src/var.h |  1 -
 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 *);
-- 
2.25.0

             reply	other threads:[~2020-02-19 16:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19 16:39 Denys Vlasenko [this message]
2020-04-29  6:07 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200219163913.11951-1-dvlasenk@redhat.com \
    --to=dvlasenk@redhat.com \
    --cc=dash@vger.kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --subject='Re: [PATCH] Remove poplocalvars() always-zero argument, make it static' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).