Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] builtin: trivial cleanup



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

Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
---
 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





Messages sorted by: Reverse Date, Date, Thread, Author