From 1b66deaca05b44f22da723c98fd42f5328f20f7b Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 27 Jan 2020 09:54:20 +0000 Subject: [PATCH] minor changes for old compilers --- hawk/lib/Hawk.cpp | 10 +++++----- hawk/lib/hawk-htb.h | 2 +- hawk/lib/hawk.h | 12 +++++------- hawk/lib/mod-sys.c | 18 ++++++++++++++++++ hawk/lib/std.c | 1 - 5 files changed, 29 insertions(+), 14 deletions(-) diff --git a/hawk/lib/Hawk.cpp b/hawk/lib/Hawk.cpp index d40bef40..b3362620 100644 --- a/hawk/lib/Hawk.cpp +++ b/hawk/lib/Hawk.cpp @@ -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); diff --git a/hawk/lib/hawk-htb.h b/hawk/lib/hawk-htb.h index b467a20e..39387b2e 100644 --- a/hawk/lib/hawk-htb.h +++ b/hawk/lib/hawk-htb.h @@ -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 /** diff --git a/hawk/lib/hawk.h b/hawk/lib/hawk.h index 12e6a66c..fd975d27 100644 --- a/hawk/lib/hawk.h +++ b/hawk/lib/hawk.h @@ -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 */ /** diff --git a/hawk/lib/mod-sys.c b/hawk/lib/mod-sys.c index cd10765d..f1ebab73 100644 --- a/hawk/lib/mod-sys.c +++ b/hawk/lib/mod-sys.c @@ -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) diff --git a/hawk/lib/std.c b/hawk/lib/std.c index d7de8d7f..7ed52cb1 100644 --- a/hawk/lib/std.c +++ b/hawk/lib/std.c @@ -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) {