1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

tweak: make better use of funptr() macro and sh.bltinfun pointer

src/cmd/ksh93/include/name.h:
- Include the ususally-wanted (Shbltin_f) typecast in funptr().

Various files:
- Change several direct foo->nvalue.bfp usages to funptr(np).
- Reduce explicit typecasts after the name.h change.
- To determine if we are (or just were) running a certain built-in
  command, instead of comparing sh.bltindata.bnode with a builtin
  table node, use sh.bltinfun to directly compare the builtin's
  function; this is more readable and efficient.
This commit is contained in:
Martijn Dekker 2022-06-20 22:21:31 +01:00
parent 05fc199c95
commit cae9af5eec
9 changed files with 16 additions and 16 deletions

View file

@ -241,7 +241,7 @@ static void check_typedef(struct comnod *tp, char intypeset)
dcl_tree = dtopen(&_Nvdisc, Dtoset);
dtview(sh.bltin_tree, dcl_tree);
}
nv_onattr(sh_addbuiltin(cp, (Shbltin_f)SYSTRUE->nvalue.bfp, NIL(void*)), NV_BLTIN|BLT_DCL);
nv_onattr(sh_addbuiltin(cp, b_true, NIL(void*)), NV_BLTIN|BLT_DCL);
}
}
/*
@ -1563,7 +1563,7 @@ static Shnode_t *simple(Lex_t *lexp,int flag, struct ionod *io)
cmdarg++;
else if(np==SYSEXEC || np==SYSREDIR)
lexp->inexec = 1;
else if(np->nvalue.bfp==(Nambfp_f)b_getopts)
else if(funptr(np)==b_getopts)
opt_get |= FOPTGET;
}
}