zsh-workers
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: zsh-workers@zsh.org
Cc: Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH] builtin: trivial cleanup
Date: Thu, 12 Nov 2020 11:38:22 -0600	[thread overview]
Message-ID: <20201112173822.1500674-1-felipe.contreras@gmail.com> (raw)

The flags were being set in exactly the same way in both branches of the
condition.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Src/builtin.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/Src/builtin.c b/Src/builtin.c
index 09eb3728c..5d780e4ca 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2231,17 +2231,12 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
 		    arrfixenv(pm->node.nam, x);
 	    }
 	}
-	if (usepm == 2)		/* do not change the PM_UNSET flag */
-	    pm->node.flags = (pm->node.flags | (on & ~PM_READONLY)) & ~off;
-	else {
-	    /*
-	     * Keep unset if using readonly in POSIX mode.
-	     */
-	    if (!(on & PM_READONLY) || !isset(POSIXBUILTINS))
-		off |= PM_UNSET;
-	    pm->node.flags = (pm->node.flags |
-			      (on & ~PM_READONLY)) & ~off;
-	}
+	/*
+	 * Keep unset if using readonly in POSIX mode unless specified otherwise.
+	 */
+	if ((usepm != 2) && !((on & PM_READONLY) && isset(POSIXBUILTINS)))
+	    off |= PM_UNSET;
+	pm->node.flags = (pm->node.flags | (on & ~PM_READONLY)) & ~off;
 	if (on & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z)) {
 	    if (typeset_setwidth(cname, pm, ops, on, 0))
 		return NULL;
-- 
2.29.2



                 reply	other threads:[~2020-11-12 17:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20201112173822.1500674-1-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=zsh-workers@zsh.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).