From b883c7a7f8ed4ed42db21a63991bc5a3d42d0375 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Tue, 9 Jun 2020 21:16:14 +0200 Subject: [PATCH] remove extra 'isalias' variable (re: 16d5ea9b) src/cmd/ksh93/bltins/typeset.c: unall(): - There's no need to keep track of whether we're unsetting an alias using a new 'isalias' vaariable, as we can just repeat the check for 'troot==shp->alias_tree'. (cherry picked from commit 68f3ae3acd0d19dd80805049a1c9afc1ae1e75c3) --- src/cmd/ksh93/bltins/typeset.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/cmd/ksh93/bltins/typeset.c b/src/cmd/ksh93/bltins/typeset.c index 9b9c2fcbe..d8623e3f3 100644 --- a/src/cmd/ksh93/bltins/typeset.c +++ b/src/cmd/ksh93/bltins/typeset.c @@ -1161,13 +1161,11 @@ static int unall(int argc, char **argv, register Dt_t *troot, Shell_t* shp) register const char *name; volatile int r; Dt_t *dp; - int nflag=0,all=0,isalias=0,isfun,jmpval; + int nflag=0,all=0,isfun,jmpval; struct checkpt buff; NOT_USED(argc); - if(troot==shp->alias_tree) { - isalias = 1; + if(troot==shp->alias_tree) name = sh_optunalias; - } else name = sh_optunset; while(r = optget(argv,name)) switch(r) @@ -1302,7 +1300,8 @@ static int unall(int argc, char **argv, register Dt_t *troot, Shell_t* shp) nv_delete(np,troottmp,0); } /* The alias has been unset by call to _nv_unset, remove it from the tree */ - else if(isalias) { + else if(troot==shp->alias_tree) + { if(nv_isattr(np, NV_NOFREE)) nv_delete(np,troot,NV_NOFREE); /* The alias is in read-only memory (shtab_aliases) */ else