mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Streamline some nval(3) and related flaggery
In the olden days, ksh used the hash(3) library to store variables,
aliases, functions, etc. For many years, it's been using the cdt(3)
library instead. But the low-level nv_search() name-value tree
lookup function was still repurposing some bit flags from the old
hash API for its options, though that API is otherwise unused.
So we were still including the entire obsolete <hash.h> API just
to use two repurposed HASH_* bit flags for nv_search(). This commit
makes nv_search() repurpose some flags from <nval.h> instead.
This commit should not change ksh's behaviour.
src/cmd/ksh93/sh/nvdisc.c:
- Make nv_search() use NV_NOSCOPE instead of HASH_NOSCOPE and
NV_REF instead of HASH_BUCKET.
- The HASH_SCOPE flag was also passed to some nv_search() calls,
but nv_search() ignores it, so that flag is deleted from those.
- Document nv_search() in a comment.
src/cmd/ksh93/include/name.h:
- Move NV_UNATTR to nval.h to join the other nv_open() options
there. (re: 1184b2ad)
src/cmd/ksh93/include/nval.h:
- Since we no longer use HASH_* macros, do not include <hash.h>.
- Remove unused NV_NOASSIGN macro, defined to 0. This was there
for "backward compatibility" since before 1995; long enough.
src/cmd/ksh93/include/shell.h:
- Bump SH_VERSION due to the nv_search() API change (even though no
changes were made to the APIs documented in nval.3 or shell.3).
All other changed files:
- Update to match the flaggery changes.
This commit is contained in:
parent
60b3e3a28d
commit
1884f57a74
21 changed files with 74 additions and 69 deletions
|
|
@ -580,7 +580,7 @@ int ed_macro(Edit_t *ep, register int i)
|
|||
ep->e_macro[2] = ed_getchar(ep,1);
|
||||
else
|
||||
ep->e_macro[2] = 0;
|
||||
if (isalnum(i)&&(np=nv_search(ep->e_macro,sh.alias_tree,HASH_SCOPE))&&(out=nv_getval(np)))
|
||||
if (isalnum(i)&&(np=nv_search(ep->e_macro,sh.alias_tree,0))&&(out=nv_getval(np)))
|
||||
{
|
||||
#if SHOPT_MULTIBYTE
|
||||
/* copy to buff in internal representation */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue