minor code touch-up again

This commit is contained in:
hyung-hwan 2020-04-17 17:19:34 +00:00
parent 53b76934d9
commit 3bae71b21f
3 changed files with 15 additions and 14 deletions

View File

@ -861,7 +861,7 @@ int Hawk::Value::setIndexedVal (Run* r, const Index& idx, hawk_val_t* v)
{ {
HAWK_ASSERT (r != HAWK_NULL); HAWK_ASSERT (r != HAWK_NULL);
if (HAWK_RTX_GETVALTYPE (r->rtx, this->val) != HAWK_VAL_MAP) if (HAWK_RTX_GETVALTYPE(r->rtx, this->val) != HAWK_VAL_MAP)
{ {
// the previous value is not a map. // the previous value is not a map.
// a new map value needs to be created first. // a new map value needs to be created first.
@ -1047,6 +1047,7 @@ int Hawk::Value::setIndexedStr (const Index& idx, const hawk_bch_t* str, bool nu
int Hawk::Value::setIndexedStr (Run* r, const Index& idx, const hawk_bch_t* str, bool numeric) int Hawk::Value::setIndexedStr (Run* r, const Index& idx, const hawk_bch_t* str, bool numeric)
{ {
hawk_val_t* tmp; hawk_val_t* tmp;
tmp = numeric? hawk_rtx_makenumorstrvalwithbchars(r->rtx, str, hawk_count_bcstr(str)): tmp = numeric? hawk_rtx_makenumorstrvalwithbchars(r->rtx, str, hawk_count_bcstr(str)):
hawk_rtx_makestrvalwithbcstr(r->rtx, str); hawk_rtx_makestrvalwithbcstr(r->rtx, str);
if (HAWK_UNLIKELY(!tmp)) if (HAWK_UNLIKELY(!tmp))
@ -1339,15 +1340,15 @@ int Hawk::Run::getGlobal (int id, Value& g) const
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
Hawk::Hawk (Mmgr* mmgr): Hawk::Hawk (Mmgr* mmgr):
Mmged (mmgr), hawk (HAWK_NULL), Mmged(mmgr), hawk(HAWK_NULL),
#if defined(HAWK_USE_HTB_FOR_FUNCTION_MAP) #if defined(HAWK_USE_HTB_FOR_FUNCTION_MAP)
functionMap (HAWK_NULL), functionMap(HAWK_NULL),
#else #else
functionMap (this), functionMap(this),
#endif #endif
source_reader (HAWK_NULL), source_writer (HAWK_NULL), source_reader(HAWK_NULL), source_writer(HAWK_NULL),
pipe_handler (HAWK_NULL), file_handler (HAWK_NULL), pipe_handler(HAWK_NULL), file_handler(HAWK_NULL),
console_handler (HAWK_NULL), runctx (this) console_handler(HAWK_NULL), runctx(this)
{ {
HAWK_MEMSET (&errinf, 0, HAWK_SIZEOF(errinf)); HAWK_MEMSET (&errinf, 0, HAWK_SIZEOF(errinf));
@ -1823,17 +1824,17 @@ int Hawk::init_runctx ()
rio.console = consoleHandler; rio.console = consoleHandler;
hawk_rtx_t* rtx = hawk_rtx_open(this->hawk, HAWK_SIZEOF(rxtn_t), &rio); hawk_rtx_t* rtx = hawk_rtx_open(this->hawk, HAWK_SIZEOF(rxtn_t), &rio);
if (rtx == HAWK_NULL) if (HAWK_UNLIKELY(!rtx))
{ {
this->retrieveError(); this->retrieveError();
return -1; return -1;
} }
rtx->_instsize += HAWK_SIZEOF(rxtn_t); rtx->_instsize += HAWK_SIZEOF(rxtn_t);
runctx.rtx = rtx; this->runctx.rtx = rtx;
rxtn_t* rxtn = GET_RXTN(rtx); rxtn_t* rxtn = GET_RXTN(rtx);
rxtn->run = &runctx; rxtn->run = &this->runctx;
return 0; return 0;
} }

View File

@ -1336,7 +1336,7 @@ public:
/// ///
const Hawk::Run* getRunContext () const const Hawk::Run* getRunContext () const
{ {
return &runctx; return &this->runctx;
} }
/// ///
@ -1348,7 +1348,7 @@ public:
/// ///
Hawk::Run* getRunContext () Hawk::Run* getRunContext ()
{ {
return &runctx; return &this->runctx;
} }
/// ///

View File

@ -131,8 +131,8 @@ static hawk_sio_t* open_sio_std (Hawk* hawk, HawkStd::Run* run, hawk_sio_std_t s
int HawkStd::open () int HawkStd::open ()
{ {
int n = Hawk::open (); int n = Hawk::open();
if (n == -1) return n; if (HAWK_UNLIKELY(n <= -1)) return n;
this->gbl_argc = this->addGlobal(HAWK_T("ARGC")); this->gbl_argc = this->addGlobal(HAWK_T("ARGC"));
this->gbl_argv = this->addGlobal(HAWK_T("ARGV")); this->gbl_argv = this->addGlobal(HAWK_T("ARGV"));