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

Remove more legacy libast code (re: f9c127e3, 651bbd56)

This removes #ifdefs checking for the existence of
SH_PLUGIN_VERSION (version check for dynamically loaded builtins)
and the SFIO identifiers SF_BUFCONST, SF_CLOSING, SF_APPENDWR,
SF_ATEXIT, all of which are defined by the bundled libast.
This commit is contained in:
Martijn Dekker 2021-03-21 04:17:05 +00:00
parent c7242de16f
commit 0b814b53bd
8 changed files with 18 additions and 80 deletions

View file

@ -2386,13 +2386,11 @@ static int subexcept(Sfio_t* sp,register int mode, void *data, Sfdisc_t* handle)
free((void*)disp);
return(0);
}
#ifdef SF_ATEXIT
else if (mode==SF_ATEXIT)
{
sfdisc(sp, SF_POPDISC);
return(0);
}
#endif
else if(mode==SF_READ)
return(0);
return(-1);

View file

@ -123,11 +123,7 @@ struct lexdata
#define poplevel(lp) (lp->lexd.lastc=lp->lexd.lex_match[--lp->lexd.level])
static char *fmttoken(Lex_t*, int, char*);
#ifdef SF_BUFCONST
static int alias_exceptf(Sfio_t*, int, void*, Sfdisc_t*);
#else
static int alias_exceptf(Sfio_t*, int, Sfdisc_t*);
#endif
static int alias_exceptf(Sfio_t*, int, void*, Sfdisc_t*);
static void setupalias(Lex_t*,const char*, Namval_t*);
static int comsub(Lex_t*,int);
static void nested_here(Lex_t*);
@ -2414,22 +2410,12 @@ struct alias
/*
* This code gets called whenever an end of string is found with alias
*/
#ifndef SF_ATEXIT
# define SF_ATEXIT 0
#endif
/*
* This code gets called whenever an end of string is found with alias
*/
#ifdef SF_BUFCONST
static int alias_exceptf(Sfio_t *iop,int type,void *data, Sfdisc_t *handle)
#else
static int alias_exceptf(Sfio_t *iop,int type,Sfdisc_t *handle)
#endif
{
register struct alias *ap = (struct alias*)handle;
register Namval_t *np;
register Lex_t *lp;
NOT_USED(data);
if(type==0 || type==SF_ATEXIT || !ap)
return(0);
lp = ap->lp;
@ -2448,7 +2434,7 @@ static int alias_exceptf(Sfio_t *iop,int type,Sfdisc_t *handle)
}
if(ap->nextc)
{
/* if last character is a blank, then next work can be alias */
/* if last character is a blank, then next word can be alias */
register int c = fcpeek(-1);
if(isblank(c))
lp->aliasok = 1;

View file

@ -108,10 +108,6 @@ struct adata
char nv_local = 0;
static void(*nullscan)(Namval_t*,void*);
#if ( SFIO_VERSION <= 20010201L )
# define _data data
#endif
/* ======== name value pair routines ======== */
#include "shnodes.h"

View file

@ -46,12 +46,6 @@
#define HERE_MEM SF_BUFSIZE /* size of here-docs kept in memory */
#if CDT_VERSION < 20111111L
#define hash nvlink.hl._hash
#else
#define hash nvlink.lh.__hash
#endif
/* These routines are local to this module */
static Shnode_t *makeparent(Lex_t*, int, Shnode_t*);
@ -1999,6 +1993,15 @@ static Shnode_t *test_primary(Lex_t *lexp)
}
#if SHOPT_KIA
/*
* ksh is currently compiled with -D_API_ast=20100309, which sets CDT_VERSION to 20100309 in src/lib/libast/include/cdt.h
* which enables a legacy Cdt API also used elsewhere in ksh. Do not remove this version check as it is not yet obsolete.
*/
#if CDT_VERSION < 20111111L
#define hash nvlink.hl._hash
#else
#define hash nvlink.lh.__hash
#endif
/*
* return an entity checksum
* The entity is created if it doesn't exist
@ -2035,6 +2038,7 @@ unsigned long kiaentity(Lex_t *lexp,const char *name,int len,int type,int first,
}
return(np->hash);
}
#undef hash
static void kia_add(register Namval_t *np, void *data)
{

View file

@ -851,26 +851,8 @@ Pathcomp_t *path_absolute(Shell_t *shp,register const char *name, Pathcomp_t *pp
shp->bltin_dir = 0;
return(oldpp);
}
#ifdef SH_PLUGIN_VERSION
if (dll = dllplugin(SH_ID, stakptr(m), NiL, SH_PLUGIN_VERSION, NiL, RTLD_LAZY, NiL, 0))
sh_addlib(shp,dll,stakptr(m),oldpp);
#else
if (dll = dllplug(SH_ID, stakptr(m), NiL, RTLD_LAZY, NiL, 0))
{
/*
* this detects the 2007-05-11 builtin context change and also
* the 2008-03-30 opt_info.num change that hit libcmd::b_head
*/
if (libcmd && !dlllook(dll, "b_pids"))
{
dlclose(dll);
dll = 0;
}
else
sh_addlib(shp,dll,stakptr(m),oldpp);
}
#endif
if(dll &&
(addr=(Shbltin_f)dlllook(dll,stakptr(n))) &&
(!(np = sh_addbuiltin(stakptr(PATH_OFFSET),NiL,NiL)) || np->nvalue.bfp!=(Nambfp_f)addr) &&