zsh-workers
 help / color / mirror / Atom feed
* [PATCH] builtin: trivial cleanup
@ 2020-11-12 17:38 Felipe Contreras
  0 siblings, 0 replies; only message in thread
From: Felipe Contreras @ 2020-11-12 17:38 UTC (permalink / raw)
  To: zsh-workers; +Cc: Felipe Contreras

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-12 17:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-12 17:38 [PATCH] builtin: trivial cleanup Felipe Contreras

zsh-workers

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/zsh-workers

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-workers zsh-workers/ http://inbox.vuxu.org/zsh-workers \
		zsh-workers@zsh.org
	public-inbox-index zsh-workers

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


code repositories for the project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git