fixed a segfault error in Awk.cpp for missed rtx->_instsize adjustment
This commit is contained in:
parent
8c6a7ae29c
commit
f89efc150a
@ -1391,9 +1391,6 @@ int Awk::open ()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// push the call back after everything else is ok.
|
// push the call back after everything else is ok.
|
||||||
// the uponDemise() is called only if Awk::open() is fully successful.
|
|
||||||
// it won't be called when qse_awk_close() is called for functionMap
|
|
||||||
// opening failure above.
|
|
||||||
qse_awk_pushecb (this->awk, &xtn->ecb);
|
qse_awk_pushecb (this->awk, &xtn->ecb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1464,7 +1461,7 @@ Awk::Run* Awk::parse (Source& in, Source& out)
|
|||||||
return QSE_NULL;
|
return QSE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (init_runctx() <= -1) return QSE_NULL;
|
if (this->init_runctx() <= -1) return QSE_NULL;
|
||||||
return &this->runctx;
|
return &this->runctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1602,6 +1599,7 @@ int Awk::init_runctx ()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rtx->_instsize += QSE_SIZEOF(rxtn_t);
|
||||||
runctx.rtx = rtx;
|
runctx.rtx = rtx;
|
||||||
|
|
||||||
rxtn_t* rxtn = GET_RXTN(rtx);
|
rxtn_t* rxtn = GET_RXTN(rtx);
|
||||||
|
@ -203,15 +203,12 @@ StdAwk::Run* StdAwk::parse (Source& in, Source& out)
|
|||||||
// but if you call parse() multiple times while
|
// but if you call parse() multiple times while
|
||||||
// setting and unsetting QSE_AWK_RIO in-between,
|
// setting and unsetting QSE_AWK_RIO in-between,
|
||||||
// cmgrtab can still be initialized when QSE_AWK_RIO is not set.
|
// cmgrtab can still be initialized when QSE_AWK_RIO is not set.
|
||||||
if (qse_htb_init (
|
if (qse_htb_init(&this->cmgrtab, this->getMmgr(), 256, 70, QSE_SIZEOF(qse_char_t), 1) <= -1)
|
||||||
&this->cmgrtab, this->getMmgr(), 256, 70,
|
|
||||||
QSE_SIZEOF(qse_char_t), 1) <= -1)
|
|
||||||
{
|
{
|
||||||
this->setError (QSE_AWK_ENOMEM);
|
this->setError (QSE_AWK_ENOMEM);
|
||||||
return QSE_NULL;
|
return QSE_NULL;
|
||||||
}
|
}
|
||||||
qse_htb_setstyle (&this->cmgrtab,
|
qse_htb_setstyle (&this->cmgrtab, qse_gethtbstyle(QSE_HTB_STYLE_INLINE_KEY_COPIER));
|
||||||
qse_gethtbstyle(QSE_HTB_STYLE_INLINE_KEY_COPIER));
|
|
||||||
this->cmgrtab_inited = true;
|
this->cmgrtab_inited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1218,8 +1218,7 @@ static int prepare_globals (qse_awk_rtx_t* rtx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* override NF to zero */
|
/* override NF to zero */
|
||||||
if (qse_awk_rtx_setgbl (
|
if (qse_awk_rtx_setgbl(rtx, QSE_AWK_GBL_NF, QSE_AWK_VAL_ZERO) <= -1) goto oops;
|
||||||
rtx, QSE_AWK_GBL_NF, QSE_AWK_VAL_ZERO) <= -1) goto oops;
|
|
||||||
|
|
||||||
/* return success */
|
/* return success */
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1990,8 +1990,7 @@ static int build_argcv (
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __build_environ (
|
static int __build_environ (qse_awk_rtx_t* rtx, int gbl_id, qse_env_char_t* envarr[])
|
||||||
qse_awk_rtx_t* rtx, int gbl_id, qse_env_char_t* envarr[])
|
|
||||||
{
|
{
|
||||||
qse_awk_val_t* v_env;
|
qse_awk_val_t* v_env;
|
||||||
qse_awk_val_t* v_tmp;
|
qse_awk_val_t* v_tmp;
|
||||||
|
@ -56,12 +56,12 @@ void* Mmgr::callocate (qse_size_t n, bool raise_exception) /*QSE_CPP_THREXCEPT1(
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
static StdMmgr __attribute__((init_priority(101))) std_dfl_mmgr; <- this solved the problem
|
static StdMmgr __attribute__((init_priority(101))) std_dfl_mmgr; //<- this solved the problem
|
||||||
#else
|
#else
|
||||||
static StdMmgr std_dfl_mmgr; <-- has an issue for undefined initialization order
|
static StdMmgr std_dfl_mmgr; //<-- has an issue for undefined initialization order
|
||||||
#endif
|
#endif
|
||||||
Mmgr* Mmgr::dfl_mmgr = &std_dfl_mmgr;
|
Mmgr* Mmgr::dfl_mmgr = &std_dfl_mmgr;
|
||||||
//Mmgr* Mmgr::dfl_mmgr = StdMmgr::getInstance(); <--- has an issue as well
|
//Mmgr* Mmgr::dfl_mmgr = StdMmgr::getInstance(); //<--- has an issue as well
|
||||||
Mmgr* Mmgr::getDFL () QSE_CPP_NOEXCEPT
|
Mmgr* Mmgr::getDFL () QSE_CPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return Mmgr::dfl_mmgr;
|
return Mmgr::dfl_mmgr;
|
||||||
|
Loading…
Reference in New Issue
Block a user