minor changes for old compilers

This commit is contained in:
hyung-hwan 2020-01-27 09:54:20 +00:00
parent ef2acc19a5
commit 1b66deaca0
5 changed files with 29 additions and 14 deletions

View File

@ -1526,11 +1526,11 @@ int Hawk::open ()
hawk_prm_t prm;
HAWK_MEMSET (&prm, 0, HAWK_SIZEOF(prm));
prm.math.pow = Hawk::pow;
prm.math.mod = Hawk::mod;
prm.modopen = Hawk::modopen;
prm.modclose = Hawk::modclose;
prm.modgetsym = Hawk::modgetsym;
prm.math.pow = &Hawk::pow;
prm.math.mod = &Hawk::mod;
prm.modopen = &Hawk::modopen;
prm.modclose = &Hawk::modclose;
prm.modgetsym = &Hawk::modgetsym;
hawk_errnum_t errnum;
this->hawk = hawk_open(this->getMmgr(), HAWK_SIZEOF(xtn_t), this->getCmgr(), &prm, &errnum);

View File

@ -363,7 +363,7 @@ HAWK_EXPORT void hawk_htb_fini (
#if defined(HAWK_HAVE_INLINE)
static HAWK_INLINE void* hawk_htb_getxtn (hawk_htb_t* htb) { return (void*)(htb + 1); }
#else
#define hawk_htb_getxtn(awk) ((void*)((hawk_htb_t*)(htb) + 1))
#define hawk_htb_getxtn(htb) ((void*)((hawk_htb_t*)(htb) + 1))
#endif
/**

View File

@ -74,8 +74,6 @@
*
* \sa hawk_rtx_t hawk_open hawk_close
*/
typedef struct hawk_t hawk_t;
#define HAWK_HDR \
hawk_oow_t _instsize; \
hawk_gem_t _gem;
@ -1462,11 +1460,11 @@ static HAWK_INLINE hawk_mmgr_t* hawk_getmmgr (hawk_t* hawk) { return ((hawk_alt_
static HAWK_INLINE hawk_cmgr_t* hawk_getcmgr (hawk_t* hawk) { return ((hawk_alt_t*)hawk)->_gem.cmgr; }
static HAWK_INLINE void hawk_setcmgr (hawk_t* hawk, hawk_cmgr_t* cmgr) { ((hawk_alt_t*)hawk)->_gem.cmgr = cmgr; }
#else
#define hawk_getxtn(awk) ((void*)((hawk_uint8_t*)hawk + ((hawk_alt_t*)hawk)->_instsize))
#define hawk_getgem(awk) (&((hawk_alt_t*)(hawk))->_gem)
#define hawk_getmmgr(awk) (((hawk_alt_t*)(hawk))->_gem.mmgr)
#define hawk_getcmgr(awk) (((hawk_alt_t*)(hawk))->_gem.cmgr)
#define hawk_setcmgr(awk,_cmgr) (((hawk_alt_t*)(hawk))->_gem.cmgr = (_cmgr))
#define hawk_getxtn(hawk) ((void*)((hawk_uint8_t*)hawk + ((hawk_alt_t*)hawk)->_instsize))
#define hawk_getgem(hawk) (&((hawk_alt_t*)(hawk))->_gem)
#define hawk_getmmgr(hawk) (((hawk_alt_t*)(hawk))->_gem.mmgr)
#define hawk_getcmgr(hawk) (((hawk_alt_t*)(hawk))->_gem.cmgr)
#define hawk_setcmgr(hawk,_cmgr) (((hawk_alt_t*)(hawk))->_gem.cmgr = (_cmgr))
#endif /* HAWK_HAVE_INLINE */
/**

View File

@ -250,7 +250,9 @@ static sys_node_t* new_sys_node_mux (hawk_rtx_t* rtx, sys_list_t* list, int fd)
node->ctx.type = SYS_NODE_DATA_TYPE_MUX;
node->ctx.flags = 0;
#if defined(USE_EPOLL)
node->ctx.u.mux.fd = fd;
#endif
return node;
}
@ -2683,6 +2685,7 @@ static int fnc_utime (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
static int fnc_openpoll (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
{
#if defined(USE_EPOLL)
sys_list_t* sys_list;
sys_node_t* sys_node = HAWK_NULL;
hawk_int_t rx;
@ -2732,10 +2735,15 @@ static int fnc_openpoll (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
/*HAWK_ASSERT (HAWK_IN_QUICKINT_RANGE(rx));*/
hawk_rtx_setretval (rtx, hawk_rtx_makeintval(rtx, rx));
return 0;
#else
hawk_rtx_setretval (rtx, hawk_rtx_makeintval(rtx, ERRNUM_TO_RC(HAWK_ENOIMPL)));
return 0;
#endif
}
static int fnc_closepoll (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
{
#if defined(USE_EPOLL)
sys_list_t* sys_list;
sys_node_t* sys_node;
hawk_int_t rx = ERRNUM_TO_RC(HAWK_ENOERR);
@ -2747,10 +2755,15 @@ static int fnc_closepoll (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
hawk_rtx_setretval (rtx, hawk_rtx_makeintval(rtx, rx));
return 0;
#else
hawk_rtx_setretval (rtx, hawk_rtx_makeintval(rtx, ERRNUM_TO_RC(HAWK_ENOIMPL)));
return 0;
#endif
}
static int fnc_addtopoll (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
{
#if defined(USE_EPOLL)
sys_list_t* sys_list;
sys_node_t* sys_node, * sys_node2;
hawk_int_t rx = ERRNUM_TO_RC(HAWK_ENOERR);
@ -2805,6 +2818,11 @@ static int fnc_addtopoll (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
done:
hawk_rtx_setretval (rtx, hawk_rtx_makeintval(rtx, rx));
return 0;
#else
hawk_rtx_setretval (rtx, hawk_rtx_makeintval(rtx, ERRNUM_TO_RC(HAWK_ENOIMPL)));
return 0;
#endif
}
static int fnc_delfrompoll (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)

View File

@ -866,7 +866,6 @@ hawk_t* hawk_openstdwithmmgr (hawk_mmgr_t* mmgr, hawk_oow_t xtnsize, hawk_cmgr_t
/* adjust the object size by the sizeof xtn_t so that hawk_getxtn() returns the right pointer. */
awk->_instsize += HAWK_SIZEOF(xtn_t);
#if defined(USE_DLFCN)
if (hawk_setopt(awk, HAWK_MODPOSTFIX, HAWK_T(".so")) <= -1)
{