some code touch up

This commit is contained in:
hyung-hwan 2020-03-03 12:00:13 +00:00
parent 957fa97ebb
commit 87656f803e
13 changed files with 166 additions and 81 deletions

View File

@ -185,11 +185,11 @@ int Hawk::Console::setFileName (const hawk_ooch_t* name)
{ {
if (this->getMode() == READ) if (this->getMode() == READ)
{ {
return hawk_rtx_setfilename(this->run->rtx, name, hawk_count_oocstr(name)); return hawk_rtx_setfilenamewithoochars(this->run->rtx, name, hawk_count_oocstr(name));
} }
else else
{ {
return hawk_rtx_setofilename(this->run->rtx, name, hawk_count_oocstr(name)); return hawk_rtx_setofilenamewithoochars(this->run->rtx, name, hawk_count_oocstr(name));
} }
} }
@ -839,7 +839,7 @@ int Hawk::Value::setMbs (const hawk_bch_t* str)
int Hawk::Value::setMbs (Run* r, const hawk_bch_t* str) int Hawk::Value::setMbs (Run* r, const hawk_bch_t* str)
{ {
hawk_val_t* tmp; hawk_val_t* tmp;
tmp = hawk_rtx_makembsval(r->rtx, str, hawk_count_bcstr(str)); tmp = hawk_rtx_makembsvalwithbchars(r->rtx, str, hawk_count_bcstr(str));
if (!tmp) if (!tmp)
{ {
r->hawk->retrieveError (r); r->hawk->retrieveError (r);
@ -1101,7 +1101,7 @@ int Hawk::Value::setIndexedMbs (const Index& idx, const hawk_bch_t* str)
int Hawk::Value::setIndexedMbs (Run* r, const Index& idx, const hawk_bch_t* str) int Hawk::Value::setIndexedMbs (Run* r, const Index& idx, const hawk_bch_t* str)
{ {
hawk_val_t* tmp; hawk_val_t* tmp;
tmp = hawk_rtx_makembsval(r->rtx, str, hawk_count_bcstr(str)); tmp = hawk_rtx_makembsvalwithbchars(r->rtx, str, hawk_count_bcstr(str));
if (tmp == HAWK_NULL) if (tmp == HAWK_NULL)
{ {
r->hawk->retrieveError (r); r->hawk->retrieveError (r);
@ -1274,7 +1274,7 @@ int Hawk::Run::setGlobal (int id, hawk_int_t v)
HAWK_ASSERT (this->rtx != HAWK_NULL); HAWK_ASSERT (this->rtx != HAWK_NULL);
hawk_val_t* tmp = hawk_rtx_makeintval (this->rtx, v); hawk_val_t* tmp = hawk_rtx_makeintval (this->rtx, v);
if (tmp == HAWK_NULL) return -1; if (HAWK_UNLIKELY(!tmp)) return -1;
hawk_rtx_refupval (this->rtx, tmp); hawk_rtx_refupval (this->rtx, tmp);
int n = hawk_rtx_setgbl (this->rtx, id, tmp); int n = hawk_rtx_setgbl (this->rtx, id, tmp);
@ -1287,7 +1287,7 @@ int Hawk::Run::setGlobal (int id, hawk_flt_t v)
HAWK_ASSERT (this->rtx != HAWK_NULL); HAWK_ASSERT (this->rtx != HAWK_NULL);
hawk_val_t* tmp = hawk_rtx_makefltval (this->rtx, v); hawk_val_t* tmp = hawk_rtx_makefltval (this->rtx, v);
if (tmp == HAWK_NULL) return -1; if (HAWK_UNLIKELY(!tmp)) return -1;
hawk_rtx_refupval (this->rtx, tmp); hawk_rtx_refupval (this->rtx, tmp);
int n = hawk_rtx_setgbl (this->rtx, id, tmp); int n = hawk_rtx_setgbl (this->rtx, id, tmp);
@ -1295,12 +1295,13 @@ int Hawk::Run::setGlobal (int id, hawk_flt_t v)
return n; return n;
} }
int Hawk::Run::setGlobal (int id, const hawk_uch_t* ptr, hawk_oow_t len) int Hawk::Run::setGlobal (int id, const hawk_uch_t* ptr, hawk_oow_t len, bool mbs)
{ {
HAWK_ASSERT (this->rtx != HAWK_NULL); HAWK_ASSERT (this->rtx != HAWK_NULL);
hawk_val_t* tmp = hawk_rtx_makestrvalwithuchars(this->rtx, ptr, len); hawk_val_t* tmp = mbs? hawk_rtx_makembsvalwithuchars(this->rtx, ptr, len):
if (tmp == HAWK_NULL) return -1; hawk_rtx_makestrvalwithuchars(this->rtx, ptr, len);
if (HAWK_UNLIKELY(!tmp)) return -1;
hawk_rtx_refupval (this->rtx, tmp); hawk_rtx_refupval (this->rtx, tmp);
int n = hawk_rtx_setgbl (this->rtx, id, tmp); int n = hawk_rtx_setgbl (this->rtx, id, tmp);
@ -1308,12 +1309,13 @@ int Hawk::Run::setGlobal (int id, const hawk_uch_t* ptr, hawk_oow_t len)
return n; return n;
} }
int Hawk::Run::setGlobal (int id, const hawk_bch_t* ptr, hawk_oow_t len) int Hawk::Run::setGlobal (int id, const hawk_bch_t* ptr, hawk_oow_t len, bool mbs)
{ {
HAWK_ASSERT (this->rtx != HAWK_NULL); HAWK_ASSERT (this->rtx != HAWK_NULL);
hawk_val_t* tmp = hawk_rtx_makestrvalwithbchars(this->rtx, ptr, len); hawk_val_t* tmp = mbs? hawk_rtx_makembsvalwithbchars(this->rtx, ptr, len):
if (tmp == HAWK_NULL) return -1; hawk_rtx_makestrvalwithbchars(this->rtx, ptr, len);
if (HAWK_UNLIKELY(!tmp)) return -1;
hawk_rtx_refupval (this->rtx, tmp); hawk_rtx_refupval (this->rtx, tmp);
int n = hawk_rtx_setgbl (this->rtx, id, tmp); int n = hawk_rtx_setgbl (this->rtx, id, tmp);

View File

@ -1238,8 +1238,8 @@ public:
/// \a ptr. /// \a ptr.
/// \return 0 on success, -1 on failure /// \return 0 on success, -1 on failure
/// ///
int setGlobal (int id, const hawk_uch_t* ptr, hawk_oow_t len); int setGlobal (int id, const hawk_uch_t* ptr, hawk_oow_t len, bool mbs = false);
int setGlobal (int id, const hawk_bch_t* ptr, hawk_oow_t len); int setGlobal (int id, const hawk_bch_t* ptr, hawk_oow_t len, bool mbs = false);
/// ///
/// The setGlobal() function sets a global variable /// The setGlobal() function sets a global variable

View File

@ -958,7 +958,7 @@ int HawkStd::open_console_in (Console& io)
return -1; return -1;
} }
if (hawk_rtx_setfilename(rtx, file, hawk_count_oocstr(file)) <= -1) if (hawk_rtx_setfilenamewithoochars(rtx, file, hawk_count_oocstr(file)) <= -1)
{ {
hawk_sio_close (sio); hawk_sio_close (sio);
hawk_rtx_freevaloocstr (rtx, v, as.ptr); hawk_rtx_freevaloocstr (rtx, v, as.ptr);
@ -1031,7 +1031,7 @@ int HawkStd::open_console_out (Console& io)
sio = open_sio(HAWK_NULL, io, file, HAWK_SIO_WRITE | HAWK_SIO_CREATE | HAWK_SIO_TRUNCATE | HAWK_SIO_IGNOREECERR); sio = open_sio(HAWK_NULL, io, file, HAWK_SIO_WRITE | HAWK_SIO_CREATE | HAWK_SIO_TRUNCATE | HAWK_SIO_IGNOREECERR);
if (sio == HAWK_NULL) return -1; if (sio == HAWK_NULL) return -1;
if (hawk_rtx_setofilename(rtx, file, hawk_count_oocstr(file)) == -1) if (hawk_rtx_setofilenamewithoochars(rtx, file, hawk_count_oocstr(file)) == -1)
{ {
hawk_sio_close (sio); hawk_sio_close (sio);
return -1; return -1;

View File

@ -71,13 +71,13 @@ static HAWK_INLINE slot_t* alloc_slot (hawk_arr_t* arr, void* dptr, hawk_oow_t d
if (arr->copier == HAWK_ARR_COPIER_SIMPLE) if (arr->copier == HAWK_ARR_COPIER_SIMPLE)
{ {
n = (slot_t*)hawk_gem_allocmem(arr->gem, HAWK_SIZEOF(slot_t)); n = (slot_t*)hawk_gem_allocmem(arr->gem, HAWK_SIZEOF(slot_t));
if (!n) return HAWK_NULL; if (HAWK_UNLIKELY(!n)) return HAWK_NULL;
DPTR(n) = dptr; DPTR(n) = dptr;
} }
else if (arr->copier == HAWK_ARR_COPIER_INLINE) else if (arr->copier == HAWK_ARR_COPIER_INLINE)
{ {
n = (slot_t*)hawk_gem_allocmem(arr->gem, HAWK_SIZEOF(slot_t) + TOB(arr,dlen)); n = (slot_t*)hawk_gem_allocmem(arr->gem, HAWK_SIZEOF(slot_t) + TOB(arr,dlen));
if (!n) return HAWK_NULL; if (HAWK_UNLIKELY(!n)) return HAWK_NULL;
HAWK_MEMCPY (n + 1, dptr, TOB(arr,dlen)); HAWK_MEMCPY (n + 1, dptr, TOB(arr,dlen));
DPTR(n) = n + 1; DPTR(n) = n + 1;
@ -85,7 +85,7 @@ static HAWK_INLINE slot_t* alloc_slot (hawk_arr_t* arr, void* dptr, hawk_oow_t d
else else
{ {
n = (slot_t*)hawk_gem_allocmem(arr->gem, HAWK_SIZEOF(slot_t)); n = (slot_t*)hawk_gem_allocmem(arr->gem, HAWK_SIZEOF(slot_t));
if (!n) return HAWK_NULL; if (HAWK_UNLIKELY(!n)) return HAWK_NULL;
DPTR(n) = arr->copier(arr, dptr, dlen); DPTR(n) = arr->copier(arr, dptr, dlen);
if (DPTR(n) == HAWK_NULL) if (DPTR(n) == HAWK_NULL)
{ {
@ -104,7 +104,7 @@ hawk_arr_t* hawk_arr_open (hawk_gem_t* gem, hawk_oow_t xtnsize, hawk_oow_t capa)
hawk_arr_t* arr; hawk_arr_t* arr;
arr = (hawk_arr_t*)hawk_gem_allocmem(gem, HAWK_SIZEOF(hawk_arr_t) + xtnsize); arr = (hawk_arr_t*)hawk_gem_allocmem(gem, HAWK_SIZEOF(hawk_arr_t) + xtnsize);
if (arr == HAWK_NULL) return HAWK_NULL; if (HAWK_UNLIKELY(!arr)) return HAWK_NULL;
if (hawk_arr_init(arr, gem, capa) <= -1) if (hawk_arr_init(arr, gem, capa) <= -1)
{ {
@ -246,7 +246,7 @@ hawk_arr_t* hawk_arr_setcapa (hawk_arr_t* arr, hawk_oow_t capa)
if (capa > 0) if (capa > 0)
{ {
tmp = (slot_t**)hawk_gem_reallocmem(arr->gem, arr->slot, HAWK_SIZEOF(*arr->slot) * capa); tmp = (slot_t**)hawk_gem_reallocmem(arr->gem, arr->slot, HAWK_SIZEOF(*arr->slot) * capa);
if (!tmp) return HAWK_NULL; if (HAWK_UNLIKELY(!tmp)) return HAWK_NULL;
} }
else else
{ {

View File

@ -166,12 +166,12 @@ hawk_fnc_t* hawk_addfncwithbcstr (hawk_t* awk, const hawk_bch_t* name, const haw
if (spec->arg.spec) if (spec->arg.spec)
{ {
wcs.ptr = hawk_dupbtoucstr(awk, spec->arg.spec, &wcs.len, 0); wcs.ptr = hawk_dupbtoucstr(awk, spec->arg.spec, &wcs.len, 0);
if (!wcs.ptr) return HAWK_NULL; if (HAWK_UNLIKELY(!wcs.ptr)) return HAWK_NULL;
wspec.arg.spec = wcs.ptr; wspec.arg.spec = wcs.ptr;
} }
wcs.ptr = hawk_dupbtoucstr(awk, name, &wcs.len, 0); wcs.ptr = hawk_dupbtoucstr(awk, name, &wcs.len, 0);
if (!wcs.ptr) if (HAWK_UNLIKELY(!wcs.ptr))
{ {
if (wspec.arg.spec) hawk_freemem (awk, (hawk_uch_t*)wspec.arg.spec); if (wspec.arg.spec) hawk_freemem (awk, (hawk_uch_t*)wspec.arg.spec);
return HAWK_NULL; return HAWK_NULL;
@ -197,12 +197,12 @@ hawk_fnc_t* hawk_addfncwithucstr (hawk_t* awk, const hawk_uch_t* name, const haw
if (spec->arg.spec) if (spec->arg.spec)
{ {
mbs.ptr = hawk_duputobcstr(awk, spec->arg.spec, &mbs.len); mbs.ptr = hawk_duputobcstr(awk, spec->arg.spec, &mbs.len);
if (!mbs.ptr) return HAWK_NULL; if (HAWK_UNLIKELY(!mbs.ptr)) return HAWK_NULL;
mspec.arg.spec = mbs.ptr; mspec.arg.spec = mbs.ptr;
} }
mbs.ptr = hawk_duputobcstr(awk, name, &mbs.len); mbs.ptr = hawk_duputobcstr(awk, name, &mbs.len);
if (!mbs.ptr) if (HAWK_UNLIKELY(!mbs.ptr))
{ {
if (mspec.arg.spec) hawk_freemem (awk, (hawk_bch_t*)mspec.arg.spec); if (mspec.arg.spec) hawk_freemem (awk, (hawk_bch_t*)mspec.arg.spec);
return HAWK_NULL; return HAWK_NULL;
@ -317,7 +317,7 @@ hawk_fnc_t* hawk_findfncwithbcs (hawk_t* awk, const hawk_bcs_t* name)
hawk_fnc_t* fnc; hawk_fnc_t* fnc;
wcs.ptr = hawk_dupbtouchars(awk, name->ptr, name->len, &wcs.len, 0); wcs.ptr = hawk_dupbtouchars(awk, name->ptr, name->len, &wcs.len, 0);
if (!wcs.ptr) return HAWK_NULL; if (HAWK_UNLIKELY(!wcs.ptr)) return HAWK_NULL;
fnc = find_fnc(awk, &wcs); fnc = find_fnc(awk, &wcs);
hawk_freemem (awk, wcs.ptr); hawk_freemem (awk, wcs.ptr);
return fnc; return fnc;
@ -331,7 +331,7 @@ hawk_fnc_t* hawk_findfncwithucs (hawk_t* awk, const hawk_ucs_t* name)
hawk_fnc_t* fnc; hawk_fnc_t* fnc;
mbs.ptr = hawk_duputobchars(awk, name->ptr, name->len, &mbs.len); mbs.ptr = hawk_duputobchars(awk, name->ptr, name->len, &mbs.len);
if (!mbs.ptr) return HAWK_NULL; if (HAWK_UNLIKELY(!mbs.ptr)) return HAWK_NULL;
fnc = find_fnc(awk, &mbs); fnc = find_fnc(awk, &mbs);
hawk_freemem (awk, mbs.ptr); hawk_freemem (awk, mbs.ptr);
return fnc; return fnc;
@ -774,7 +774,7 @@ int hawk_fnc_substr (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
if (lindex >= (hawk_int_t)len) lindex = (hawk_int_t)len; if (lindex >= (hawk_int_t)len) lindex = (hawk_int_t)len;
if (lcount > (hawk_int_t)len - lindex) lcount = (hawk_int_t)len - lindex; if (lcount > (hawk_int_t)len - lindex) lcount = (hawk_int_t)len - lindex;
r = hawk_rtx_makembsval(rtx, &str[lindex], (hawk_oow_t)lcount); r = hawk_rtx_makembsvalwithbchars(rtx, &str[lindex], (hawk_oow_t)lcount);
if (!r) return -1; if (!r) return -1;
} }
else else

View File

@ -2346,7 +2346,7 @@ HAWK_EXPORT hawk_val_t* hawk_rtx_getgbl (
*/ */
HAWK_EXPORT int hawk_rtx_setgbl ( HAWK_EXPORT int hawk_rtx_setgbl (
hawk_rtx_t* rtx, hawk_rtx_t* rtx,
int id, int id,
hawk_val_t* val hawk_val_t* val
); );
@ -2366,21 +2366,34 @@ HAWK_EXPORT void hawk_rtx_setretval (
/** /**
* The hawk_rtx_setfilename() function sets FILENAME. * The hawk_rtx_setfilename() function sets FILENAME.
*/ */
HAWK_EXPORT int hawk_rtx_setfilename ( HAWK_EXPORT int hawk_rtx_setfilenamewithuchars (
hawk_rtx_t* rtx, /**< runtime context */ hawk_rtx_t* rtx, /**< runtime context */
const hawk_ooch_t* str, /**< name pointer */ const hawk_uch_t* str, /**< name pointer */
hawk_oow_t len /**< name length */ hawk_oow_t len /**< name length */
);
HAWK_EXPORT int hawk_rtx_setfilenamewithbchars (
hawk_rtx_t* rtx, /**< runtime context */
const hawk_bch_t* str, /**< name pointer */
hawk_oow_t len /**< name length */
); );
/** /**
* The hawk_rtx_setofilename() function sets OFILENAME. * The hawk_rtx_setofilename() function sets OFILENAME.
*/ */
HAWK_EXPORT int hawk_rtx_setofilename ( HAWK_EXPORT int hawk_rtx_setofilenamewithuchars (
hawk_rtx_t* rtx, /**< runtime context */ hawk_rtx_t* rtx, /**< runtime context */
const hawk_ooch_t* str, /**< name pointer */ const hawk_uch_t* str, /**< name pointer */
hawk_oow_t len /**< name length */ hawk_oow_t len /**< name length */
); );
HAWK_EXPORT int hawk_rtx_setofilenamewithbchars (
hawk_rtx_t* rtx, /**< runtime context */
const hawk_bch_t* str, /**< name pointer */
hawk_oow_t len /**< name length */
);
HAWK_EXPORT int hawk_rtx_setscriptnamewithuchars ( HAWK_EXPORT int hawk_rtx_setscriptnamewithuchars (
hawk_rtx_t* rtx, /**< runtime context */ hawk_rtx_t* rtx, /**< runtime context */
const hawk_uch_t* str, /**< name pointer */ const hawk_uch_t* str, /**< name pointer */
@ -2394,8 +2407,12 @@ HAWK_EXPORT int hawk_rtx_setscriptnamewithbchars (
); );
#if defined(HAWK_OOCH_IS_UCH) #if defined(HAWK_OOCH_IS_UCH)
# define hawk_rtx_setfilenamewithoochars hawk_rtx_setfilenamewithuchars
# define hawk_rtx_setofilenamewithoochars hawk_rtx_setofilenamewithuchars
# define hawk_rtx_setscriptnamewithoochars hawk_rtx_setscriptnamewithuchars # define hawk_rtx_setscriptnamewithoochars hawk_rtx_setscriptnamewithuchars
#else #else
# define hawk_rtx_setfilenamewithoochars hawk_rtx_setfilenamewithbchars
# define hawk_rtx_setofilenamewithoochars hawk_rtx_setofilenamewithbchars
# define hawk_rtx_setscriptnamewithoochars hawk_rtx_setscriptnamewithbchars # define hawk_rtx_setscriptnamewithoochars hawk_rtx_setscriptnamewithbchars
#endif #endif
@ -2724,10 +2741,10 @@ HAWK_EXPORT hawk_val_t* hawk_rtx_makenstrvalwithbcs (
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/** /**
* The hawk_rtx_makebytearrvaal() function create a byte array value. * The hawk_rtx_makembsvalwithbchars() function create a byte array value.
* \return value on success, #HAWK_NULL on failure * \return value on success, #HAWK_NULL on failure
*/ */
hawk_val_t* hawk_rtx_makembsval ( hawk_val_t* hawk_rtx_makembsvalwithbchars (
hawk_rtx_t* rtx, hawk_rtx_t* rtx,
const hawk_bch_t* ptr, const hawk_bch_t* ptr,
hawk_oow_t len hawk_oow_t len
@ -2738,6 +2755,18 @@ hawk_val_t* hawk_rtx_makembsvalwithbcs (
const hawk_bcs_t* bcs const hawk_bcs_t* bcs
); );
hawk_val_t* hawk_rtx_makembsvalwithuchars (
hawk_rtx_t* rtx,
const hawk_uch_t* ptr,
hawk_oow_t len
);
hawk_val_t* hawk_rtx_makembsvalwithucs (
hawk_rtx_t* rtx,
const hawk_ucs_t* ucs
);
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/** /**

View File

@ -62,7 +62,7 @@ HAWK_INLINE pair_t* hawk_htb_allocpair (hawk_htb_t* htb, void* kptr, hawk_oow_t
if (vcop == HAWK_HTB_COPIER_INLINE) as += VTOB(htb,vlen); if (vcop == HAWK_HTB_COPIER_INLINE) as += VTOB(htb,vlen);
n = (pair_t*) hawk_gem_allocmem(htb->gem, as); n = (pair_t*) hawk_gem_allocmem(htb->gem, as);
if (n == HAWK_NULL) return HAWK_NULL; if (HAWK_UNLIKELY(!n)) return HAWK_NULL;
NEXT(n) = HAWK_NULL; NEXT(n) = HAWK_NULL;
@ -160,7 +160,7 @@ static HAWK_INLINE pair_t* change_pair_val (hawk_htb_t* htb, pair_t* pair, void*
{ {
/* need to reconstruct the pair */ /* need to reconstruct the pair */
pair_t* p = hawk_htb_allocpair(htb, KPTR(pair), KLEN(pair), vptr, vlen); pair_t* p = hawk_htb_allocpair(htb, KPTR(pair), KLEN(pair), vptr, vlen);
if (p == HAWK_NULL) return HAWK_NULL; if (HAWK_UNLIKELY(!p)) return HAWK_NULL;
hawk_htb_freepair (htb, pair); hawk_htb_freepair (htb, pair);
return p; return p;
} }
@ -168,7 +168,7 @@ static HAWK_INLINE pair_t* change_pair_val (hawk_htb_t* htb, pair_t* pair, void*
else else
{ {
void* nvptr = vcop(htb, vptr, vlen); void* nvptr = vcop(htb, vptr, vlen);
if (nvptr == HAWK_NULL) return HAWK_NULL; if (HAWK_UNLIKELY(!nvptr)) return HAWK_NULL;
VPTR(pair) = nvptr; VPTR(pair) = nvptr;
VLEN(pair) = vlen; VLEN(pair) = vlen;
} }
@ -260,7 +260,7 @@ hawk_htb_t* hawk_htb_open (hawk_gem_t* gem, hawk_oow_t xtnsize, hawk_oow_t capa,
hawk_htb_t* htb; hawk_htb_t* htb;
htb = (hawk_htb_t*)hawk_gem_allocmem(gem, HAWK_SIZEOF(hawk_htb_t) + xtnsize); htb = (hawk_htb_t*)hawk_gem_allocmem(gem, HAWK_SIZEOF(hawk_htb_t) + xtnsize);
if (!htb) return HAWK_NULL; if (HAWK_UNLIKELY(!htb)) return HAWK_NULL;
if (hawk_htb_init(htb, gem, capa, factor, kscale, vscale) <= -1) if (hawk_htb_init(htb, gem, capa, factor, kscale, vscale) <= -1)
{ {
@ -503,7 +503,7 @@ static HAWK_INLINE pair_t* insert (hawk_htb_t* htb, void* kptr, hawk_oow_t klen,
HAWK_ASSERT (pair == HAWK_NULL); HAWK_ASSERT (pair == HAWK_NULL);
pair = hawk_htb_allocpair (htb, kptr, klen, vptr, vlen); pair = hawk_htb_allocpair (htb, kptr, klen, vptr, vlen);
if (pair == HAWK_NULL) return HAWK_NULL; /* error */ if (HAWK_UNLIKELY(!pair)) return HAWK_NULL; /* error */
NEXT(pair) = htb->bucket[hc]; NEXT(pair) = htb->bucket[hc];
htb->bucket[hc] = pair; htb->bucket[hc] = pair;
@ -584,7 +584,7 @@ pair_t* hawk_htb_cbsert (hawk_htb_t* htb, void* kptr, hawk_oow_t klen, cbserter_
HAWK_ASSERT (pair == HAWK_NULL); HAWK_ASSERT (pair == HAWK_NULL);
pair = cbserter(htb, HAWK_NULL, kptr, klen, ctx); pair = cbserter(htb, HAWK_NULL, kptr, klen, ctx);
if (pair == HAWK_NULL) return HAWK_NULL; /* error */ if (HAWK_UNLIKELY(!pair)) return HAWK_NULL; /* error */
NEXT(pair) = htb->bucket[hc]; NEXT(pair) = htb->bucket[hc];
htb->bucket[hc] = pair; htb->bucket[hc] = pair;

View File

@ -45,7 +45,7 @@ static int fnc_normspace (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
str0 = hawk_rtx_valtobcstrdup(rtx, a0, &len0); str0 = hawk_rtx_valtobcstrdup(rtx, a0, &len0);
if (!str0) return -1; if (!str0) return -1;
len0 = hawk_compact_bchars(str0, len0); len0 = hawk_compact_bchars(str0, len0);
retv = hawk_rtx_makembsval(rtx, str0, len0); retv = hawk_rtx_makembsvalwithbchars(rtx, str0, len0);
hawk_rtx_freemem (rtx, str0); hawk_rtx_freemem (rtx, str0);
} }
else else
@ -80,7 +80,7 @@ static int trim (hawk_rtx_t* rtx, int flags)
path.ptr = ((hawk_val_mbs_t*)a0)->val.ptr; path.ptr = ((hawk_val_mbs_t*)a0)->val.ptr;
path.len = ((hawk_val_mbs_t*)a0)->val.len; path.len = ((hawk_val_mbs_t*)a0)->val.len;
npath = hawk_trim_bchars(path.ptr, &path.len, flags); npath = hawk_trim_bchars(path.ptr, &path.len, flags);
retv = hawk_rtx_makembsval(rtx, npath, path.len); retv = hawk_rtx_makembsvalwithbchars(rtx, npath, path.len);
} }
else else
{ {
@ -435,7 +435,7 @@ static int fnc_tombs (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
if (!cmgr) if (!cmgr)
{ {
/* if the encoding name is not known, return a zero-length string */ /* if the encoding name is not known, return a zero-length string */
r = hawk_rtx_makembsval(rtx, HAWK_NULL, 0); /* this never fails for length 0 */ r = hawk_rtx_makembsvalwithbchars(rtx, HAWK_NULL, 0); /* this never fails for length 0 */
goto done; goto done;
} }
} }

View File

@ -675,7 +675,7 @@ static int fnc_read (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
hawk_val_t* sv; hawk_val_t* sv;
int x; int x;
sv = hawk_rtx_makembsval(rtx, sys_list->ctx.readbuf, rx); sv = hawk_rtx_makembsvalwithbchars(rtx, sys_list->ctx.readbuf, rx);
if (!sv) if (!sv)
{ {
rx = copy_error_to_sys_list(rtx, sys_list); rx = copy_error_to_sys_list(rtx, sys_list);
@ -3533,7 +3533,7 @@ static int fnc_recvfrom (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
hawk_val_t* sv; hawk_val_t* sv;
int x; int x;
sv = hawk_rtx_makembsval(rtx, sys_list->ctx.readbuf, rx); sv = hawk_rtx_makembsvalwithbchars(rtx, sys_list->ctx.readbuf, rx);
if (!sv) if (!sv)
{ {
rx = copy_error_to_sys_list(rtx, sys_list); rx = copy_error_to_sys_list(rtx, sys_list);

View File

@ -663,13 +663,13 @@ int hawk_rtx_setscriptnamewithbchars (hawk_rtx_t* rtx, const hawk_bch_t* name, h
return n; return n;
} }
int hawk_rtx_setfilename (hawk_rtx_t* rtx, const hawk_ooch_t* name, hawk_oow_t len) int hawk_rtx_setfilenamewithuchars (hawk_rtx_t* rtx, const hawk_uch_t* name, hawk_oow_t len)
{ {
hawk_val_t* tmp; hawk_val_t* tmp;
int n; int n;
tmp = hawk_rtx_makestrvalwithoochars(rtx, name, len); tmp = hawk_rtx_makestrvalwithuchars(rtx, name, len);
if (tmp == HAWK_NULL) return -1; if (HAWK_UNLIKELY(!tmp)) return -1;
hawk_rtx_refupval (rtx, tmp); hawk_rtx_refupval (rtx, tmp);
n = hawk_rtx_setgbl (rtx, HAWK_GBL_FILENAME, tmp); n = hawk_rtx_setgbl (rtx, HAWK_GBL_FILENAME, tmp);
@ -678,15 +678,50 @@ int hawk_rtx_setfilename (hawk_rtx_t* rtx, const hawk_ooch_t* name, hawk_oow_t l
return n; return n;
} }
int hawk_rtx_setofilename (hawk_rtx_t* rtx, const hawk_ooch_t* name, hawk_oow_t len) int hawk_rtx_setfilenamewithbchars (hawk_rtx_t* rtx, const hawk_bch_t* name, hawk_oow_t len)
{
hawk_val_t* tmp;
int n;
tmp = hawk_rtx_makestrvalwithbchars(rtx, name, len);
if (HAWK_UNLIKELY(!tmp)) return -1;
hawk_rtx_refupval (rtx, tmp);
n = hawk_rtx_setgbl (rtx, HAWK_GBL_FILENAME, tmp);
hawk_rtx_refdownval (rtx, tmp);
return n;
}
int hawk_rtx_setofilenamewithuchars (hawk_rtx_t* rtx, const hawk_uch_t* name, hawk_oow_t len)
{ {
hawk_val_t* tmp; hawk_val_t* tmp;
int n; int n;
if (rtx->awk->opt.trait & HAWK_NEXTOFILE) if (rtx->awk->opt.trait & HAWK_NEXTOFILE)
{ {
tmp = hawk_rtx_makestrvalwithoochars(rtx, name, len); tmp = hawk_rtx_makestrvalwithuchars(rtx, name, len);
if (tmp == HAWK_NULL) return -1; if (HAWK_UNLIKELY(!tmp)) return -1;
hawk_rtx_refupval (rtx, tmp);
n = hawk_rtx_setgbl (rtx, HAWK_GBL_OFILENAME, tmp);
hawk_rtx_refdownval (rtx, tmp);
}
else n = 0;
return n;
}
int hawk_rtx_setofilenamewithbchars (hawk_rtx_t* rtx, const hawk_bch_t* name, hawk_oow_t len)
{
hawk_val_t* tmp;
int n;
if (rtx->awk->opt.trait & HAWK_NEXTOFILE)
{
tmp = hawk_rtx_makestrvalwithbchars(rtx, name, len);
if (HAWK_UNLIKELY(!tmp)) return -1;
hawk_rtx_refupval (rtx, tmp); hawk_rtx_refupval (rtx, tmp);
n = hawk_rtx_setgbl (rtx, HAWK_GBL_OFILENAME, tmp); n = hawk_rtx_setgbl (rtx, HAWK_GBL_OFILENAME, tmp);
@ -6480,7 +6515,7 @@ static hawk_val_t* eval_str (hawk_rtx_t* rtx, hawk_nde_t* nde)
static hawk_val_t* eval_mbs (hawk_rtx_t* rtx, hawk_nde_t* nde) static hawk_val_t* eval_mbs (hawk_rtx_t* rtx, hawk_nde_t* nde)
{ {
hawk_val_t* val; hawk_val_t* val;
val = hawk_rtx_makembsval(rtx, ((hawk_nde_mbs_t*)nde)->ptr, ((hawk_nde_mbs_t*)nde)->len); val = hawk_rtx_makembsvalwithbchars(rtx, ((hawk_nde_mbs_t*)nde)->ptr, ((hawk_nde_mbs_t*)nde)->len);
if (val == HAWK_NULL) ADJERR_LOC (rtx, &nde->loc); if (val == HAWK_NULL) ADJERR_LOC (rtx, &nde->loc);
return val; return val;
} }

View File

@ -2119,7 +2119,7 @@ static int open_rio_console (hawk_rtx_t* rtx, hawk_rio_arg_t* riod)
if (rxtn->c.cmgr) hawk_sio_setcmgr (sio, rxtn->c.cmgr); if (rxtn->c.cmgr) hawk_sio_setcmgr (sio, rxtn->c.cmgr);
if (hawk_rtx_setfilename(rtx, file, hawk_count_oocstr(file)) <= -1) if (hawk_rtx_setfilenamewithoochars(rtx, file, hawk_count_oocstr(file)) <= -1)
{ {
hawk_sio_close (sio); hawk_sio_close (sio);
hawk_rtx_freevaloocstr (rtx, v, as.ptr); hawk_rtx_freevaloocstr (rtx, v, as.ptr);
@ -2181,7 +2181,7 @@ static int open_rio_console (hawk_rtx_t* rtx, hawk_rio_arg_t* riod)
if (rxtn->c.cmgr) hawk_sio_setcmgr (sio, rxtn->c.cmgr); if (rxtn->c.cmgr) hawk_sio_setcmgr (sio, rxtn->c.cmgr);
if (hawk_rtx_setofilename(rtx, file, hawk_count_oocstr(file)) <= -1) if (hawk_rtx_setofilenamewithoochars(rtx, file, hawk_count_oocstr(file)) <= -1)
{ {
hawk_sio_close (sio); hawk_sio_close (sio);
return -1; return -1;
@ -2623,7 +2623,7 @@ static hawk_rtx_t* open_rtx_std (
*/ */
if (ocf && ocf[0]) if (ocf && ocf[0])
{ {
if (hawk_rtx_setofilename(rtx, ocf[0], hawk_count_oocstr(ocf[0])) <= -1) if (hawk_rtx_setofilenamewithoochars(rtx, ocf[0], hawk_count_oocstr(ocf[0])) <= -1)
{ {
hawk_rtx_errortohawk (rtx, awk); hawk_rtx_errortohawk (rtx, awk);
hawk_rtx_close (rtx); hawk_rtx_close (rtx);
@ -2755,7 +2755,7 @@ hawk_rtx_t* hawk_rtx_openstdwithucstr (
#else #else
xicf[i] = hawk_dupucstr(awk, icf[i], HAWK_NULL); xicf[i] = hawk_dupucstr(awk, icf[i], HAWK_NULL);
#endif #endif
if (!xicf[i]) goto done; if (HAWK_UNLIKELY(!xicf[i])) goto done;
} }
xicf[i] = HAWK_NULL; xicf[i] = HAWK_NULL;
} }

View File

@ -167,7 +167,7 @@ static HAWK_INLINE hawk_val_t* make_str_val (hawk_rtx_t* rtx, const hawk_ooch_t*
hawk_oow_t i; hawk_oow_t i;
#endif #endif
if (len1 <= 0 && len2 <= 0) return hawk_val_zls; if (HAWK_UNLIKELY(len1 <= 0 && len2 <= 0)) return hawk_val_zls;
aligned_len = HAWK_ALIGN_POW2((len1 + len2 + 1), FEATURE_SCACHE_BLOCK_UNIT); aligned_len = HAWK_ALIGN_POW2((len1 + len2 + 1), FEATURE_SCACHE_BLOCK_UNIT);
#if defined(ENABLE_FEATURE_SCACHE) #if defined(ENABLE_FEATURE_SCACHE)
@ -183,7 +183,7 @@ static HAWK_INLINE hawk_val_t* make_str_val (hawk_rtx_t* rtx, const hawk_ooch_t*
#endif #endif
val = (hawk_val_str_t*)hawk_rtx_callocmem(rtx, HAWK_SIZEOF(hawk_val_str_t) + (aligned_len * HAWK_SIZEOF(hawk_ooch_t))); val = (hawk_val_str_t*)hawk_rtx_callocmem(rtx, HAWK_SIZEOF(hawk_val_str_t) + (aligned_len * HAWK_SIZEOF(hawk_ooch_t)));
if (!val) return HAWK_NULL; if (HAWK_UNLIKELY(!val)) return HAWK_NULL;
#if defined(ENABLE_FEATURE_SCACHE) #if defined(ENABLE_FEATURE_SCACHE)
init: init:
@ -216,7 +216,7 @@ hawk_val_t* hawk_rtx_makestrvalwithuchars (hawk_rtx_t* rtx, const hawk_uch_t* uc
hawk_oow_t bcslen; hawk_oow_t bcslen;
bcs = hawk_rtx_duputobchars(rtx, ucs, len, &bcslen); bcs = hawk_rtx_duputobchars(rtx, ucs, len, &bcslen);
if (!bcs) return HAWK_NULL; if (HAWK_UNLIKELY(!bcs)) return HAWK_NULL;
v = make_str_val(rtx, bcs, bcslen, HAWK_NULL, 0); v = make_str_val(rtx, bcs, bcslen, HAWK_NULL, 0);
hawk_rtx_freemem (rtx, bcs); hawk_rtx_freemem (rtx, bcs);
@ -232,7 +232,7 @@ hawk_val_t* hawk_rtx_makestrvalwithbchars (hawk_rtx_t* rtx, const hawk_bch_t* bc
hawk_oow_t ucslen; hawk_oow_t ucslen;
ucs = hawk_rtx_dupbtouchars(rtx, bcs, len, &ucslen, 1); ucs = hawk_rtx_dupbtouchars(rtx, bcs, len, &ucslen, 1);
if (!ucs) return HAWK_NULL; if (HAWK_UNLIKELY(!ucs)) return HAWK_NULL;
v = make_str_val(rtx, ucs, ucslen, HAWK_NULL, 0); v = make_str_val(rtx, ucs, ucslen, HAWK_NULL, 0);
hawk_rtx_freemem (rtx, ucs); hawk_rtx_freemem (rtx, ucs);
@ -272,7 +272,7 @@ hawk_val_t* hawk_rtx_makestrvalwithuchars2 (hawk_rtx_t* rtx, const hawk_uch_t* u
hawk_oow_t bcslen; hawk_oow_t bcslen;
bcs = hawk_rtx_dupu2tobchars(rtx, ucs1, len1, ucs2, len2, &bcslen); bcs = hawk_rtx_dupu2tobchars(rtx, ucs1, len1, ucs2, len2, &bcslen);
if (!bcs) return HAWK_NULL; if (HAWK_UNLIKELY(!bcs)) return HAWK_NULL;
v = make_str_val(rtx, bcs, bcslen, HAWK_NULL, 0); v = make_str_val(rtx, bcs, bcslen, HAWK_NULL, 0);
hawk_rtx_freemem (rtx, bcs); hawk_rtx_freemem (rtx, bcs);
@ -288,7 +288,7 @@ hawk_val_t* hawk_rtx_makestrvalwithbchars2 (hawk_rtx_t* rtx, const hawk_bch_t* b
hawk_oow_t ucslen; hawk_oow_t ucslen;
ucs = hawk_rtx_dupb2touchars(rtx, bcs1, len1, bcs2, len2, &ucslen, 1); ucs = hawk_rtx_dupb2touchars(rtx, bcs1, len1, bcs2, len2, &ucslen, 1);
if (!ucs) return HAWK_NULL; if (HAWK_UNLIKELY(!ucs)) return HAWK_NULL;
v = make_str_val(rtx, ucs, ucslen, HAWK_NULL, 0); v = make_str_val(rtx, ucs, ucslen, HAWK_NULL, 0);
hawk_rtx_freemem (rtx, ucs); hawk_rtx_freemem (rtx, ucs);
@ -298,8 +298,6 @@ hawk_val_t* hawk_rtx_makestrvalwithbchars2 (hawk_rtx_t* rtx, const hawk_bch_t* b
#endif #endif
} }
hawk_val_t* hawk_rtx_makenstrvalwithuchars (hawk_rtx_t* rtx, const hawk_uch_t* ptr, hawk_oow_t len) hawk_val_t* hawk_rtx_makenstrvalwithuchars (hawk_rtx_t* rtx, const hawk_uch_t* ptr, hawk_oow_t len)
{ {
hawk_t* hawk = hawk_rtx_gethawk(rtx); hawk_t* hawk = hawk_rtx_gethawk(rtx);
@ -370,17 +368,17 @@ hawk_val_t* hawk_rtx_makenstrvalwithbcs (hawk_rtx_t* rtx, const hawk_bcs_t* str)
} }
hawk_val_t* hawk_rtx_makembsval (hawk_rtx_t* rtx, const hawk_bch_t* ptr, hawk_oow_t len) hawk_val_t* hawk_rtx_makembsvalwithbchars (hawk_rtx_t* rtx, const hawk_bch_t* ptr, hawk_oow_t len)
{ {
hawk_val_mbs_t* val = HAWK_NULL; hawk_val_mbs_t* val = HAWK_NULL;
hawk_oow_t xsz; hawk_oow_t xsz;
if (len <= 0) return hawk_val_zlm; if (HAWK_UNLIKELY(len <= 0)) return hawk_val_zlm;
xsz = len * HAWK_SIZEOF(*ptr); xsz = len * HAWK_SIZEOF(*ptr);
val = (hawk_val_mbs_t*)hawk_rtx_callocmem(rtx, HAWK_SIZEOF(hawk_val_mbs_t) + xsz + HAWK_SIZEOF(*ptr)); val = (hawk_val_mbs_t*)hawk_rtx_callocmem(rtx, HAWK_SIZEOF(hawk_val_mbs_t) + xsz + HAWK_SIZEOF(*ptr));
if (!val) return HAWK_NULL; if (HAWK_UNLIKELY(!val)) return HAWK_NULL;
val->v_type = HAWK_VAL_MBS; val->v_type = HAWK_VAL_MBS;
val->ref = 0; val->ref = 0;
@ -395,9 +393,32 @@ hawk_val_t* hawk_rtx_makembsval (hawk_rtx_t* rtx, const hawk_bch_t* ptr, hawk_oo
return (hawk_val_t*)val; return (hawk_val_t*)val;
} }
hawk_val_t* hawk_rtx_makembsvalwithbcs (hawk_rtx_t* rtx, const hawk_bcs_t* mxstr) hawk_val_t* hawk_rtx_makembsvalwithbcs (hawk_rtx_t* rtx, const hawk_bcs_t* bcs)
{ {
return hawk_rtx_makembsval(rtx, mxstr->ptr, mxstr->len); return hawk_rtx_makembsvalwithbchars(rtx, bcs->ptr, bcs->len);
}
hawk_val_t* hawk_rtx_makembsvalwithuchars (hawk_rtx_t* rtx, const hawk_uch_t* ucs, hawk_oow_t len)
{
hawk_val_t* val;
hawk_bch_t* bcs;
hawk_oow_t bcslen;
if (HAWK_UNLIKELY(len <= 0)) return hawk_val_zlm;
bcs = hawk_rtx_duputobchars(rtx, ucs, len, &bcslen);
if (HAWK_UNLIKELY(!bcs)) return HAWK_NULL;
val = hawk_rtx_makembsvalwithbchars(rtx, bcs, bcslen);
hawk_rtx_freemem (rtx, bcs);
return val;
}
hawk_val_t* hawk_rtx_makembsvalwithucs (hawk_rtx_t* rtx, const hawk_ucs_t* ucs)
{
return hawk_rtx_makembsvalwithuchars(rtx, ucs->ptr, ucs->len);
} }
hawk_val_t* hawk_rtx_makerexval (hawk_rtx_t* rtx, const hawk_oocs_t* str, hawk_tre_t* code[2]) hawk_val_t* hawk_rtx_makerexval (hawk_rtx_t* rtx, const hawk_oocs_t* str, hawk_tre_t* code[2])
@ -412,7 +433,7 @@ hawk_val_t* hawk_rtx_makerexval (hawk_rtx_t* rtx, const hawk_oocs_t* str, hawk_t
*/ */
totsz = HAWK_SIZEOF(*val) + (HAWK_SIZEOF(*str->ptr) * (str->len + 1)); totsz = HAWK_SIZEOF(*val) + (HAWK_SIZEOF(*str->ptr) * (str->len + 1));
val = (hawk_val_rex_t*)hawk_rtx_callocmem(rtx, totsz); val = (hawk_val_rex_t*)hawk_rtx_callocmem(rtx, totsz);
if (!val) return HAWK_NULL; if (HAWK_UNLIKELY(!val)) return HAWK_NULL;
val->v_type = HAWK_VAL_REX; val->v_type = HAWK_VAL_REX;
val->ref = 0; val->ref = 0;
@ -519,7 +540,7 @@ hawk_val_t* hawk_rtx_makemapvalwithdata (hawk_rtx_t* rtx, hawk_val_map_data_t da
hawk_val_map_data_t* p; hawk_val_map_data_t* p;
map = hawk_rtx_makemapval(rtx); map = hawk_rtx_makemapval(rtx);
if (!map) return HAWK_NULL; if (HAWK_UNLIKELY(!map)) return HAWK_NULL;
for (p = data; p->key.ptr; p++) for (p = data; p->key.ptr; p++)
{ {
@ -601,7 +622,7 @@ hawk_val_t* hawk_rtx_getmapvalfld (hawk_rtx_t* rtx, hawk_val_t* map, const hawk_
HAWK_ASSERT (HAWK_RTX_GETVALTYPE(rtx, map) == HAWK_VAL_MAP); HAWK_ASSERT (HAWK_RTX_GETVALTYPE(rtx, map) == HAWK_VAL_MAP);
pair = hawk_htb_search(((hawk_val_map_t*)map)->map, kptr, klen); pair = hawk_htb_search(((hawk_val_map_t*)map)->map, kptr, klen);
if (pair == HAWK_NULL) if (!pair)
{ {
/* the given key is not found in the map. /* the given key is not found in the map.
* we return NULL here as this function is called by * we return NULL here as this function is called by
@ -615,16 +636,14 @@ hawk_val_t* hawk_rtx_getmapvalfld (hawk_rtx_t* rtx, hawk_val_t* map, const hawk_
return HAWK_HTB_VPTR(pair); return HAWK_HTB_VPTR(pair);
} }
hawk_val_map_itr_t* hawk_rtx_getfirstmapvalitr ( hawk_val_map_itr_t* hawk_rtx_getfirstmapvalitr (hawk_rtx_t* rtx, hawk_val_t* map, hawk_val_map_itr_t* itr)
hawk_rtx_t* rtx, hawk_val_t* map, hawk_val_map_itr_t* itr)
{ {
HAWK_ASSERT (HAWK_RTX_GETVALTYPE (rtx, map) == HAWK_VAL_MAP); HAWK_ASSERT (HAWK_RTX_GETVALTYPE (rtx, map) == HAWK_VAL_MAP);
itr->pair = hawk_htb_getfirstpair (((hawk_val_map_t*)map)->map, &itr->buckno); itr->pair = hawk_htb_getfirstpair (((hawk_val_map_t*)map)->map, &itr->buckno);
return itr->pair? itr: HAWK_NULL; return itr->pair? itr: HAWK_NULL;
} }
hawk_val_map_itr_t* hawk_rtx_getnextmapvalitr ( hawk_val_map_itr_t* hawk_rtx_getnextmapvalitr (hawk_rtx_t* rtx, hawk_val_t* map, hawk_val_map_itr_t* itr)
hawk_rtx_t* rtx, hawk_val_t* map, hawk_val_map_itr_t* itr)
{ {
HAWK_ASSERT (HAWK_RTX_GETVALTYPE (rtx, map) == HAWK_VAL_MAP); HAWK_ASSERT (HAWK_RTX_GETVALTYPE (rtx, map) == HAWK_VAL_MAP);
itr->pair = hawk_htb_getnextpair (((hawk_val_map_t*)map)->map, itr->pair, &itr->buckno); itr->pair = hawk_htb_getnextpair (((hawk_val_map_t*)map)->map, itr->pair, &itr->buckno);
@ -654,7 +673,7 @@ hawk_val_t* hawk_rtx_makefunval (hawk_rtx_t* rtx, const hawk_fun_t* fun)
hawk_val_fun_t* val; hawk_val_fun_t* val;
val = (hawk_val_fun_t*)hawk_rtx_callocmem(rtx, HAWK_SIZEOF(*val)); val = (hawk_val_fun_t*)hawk_rtx_callocmem(rtx, HAWK_SIZEOF(*val));
if (!val) return HAWK_NULL; if (HAWK_UNLIKELY(!val)) return HAWK_NULL;
val->v_type = HAWK_VAL_FUN; val->v_type = HAWK_VAL_FUN;
val->ref = 0; val->ref = 0;

View File

@ -1591,7 +1591,7 @@ static int fnc_stmt_fetch (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
cv = hawk_rtx_makestrvalwithbchars(rtx, data->u.sv.ptr, data->u.sv.len); cv = hawk_rtx_makestrvalwithbchars(rtx, data->u.sv.ptr, data->u.sv.len);
break; break;
case MYSQL_TYPE_BLOB: case MYSQL_TYPE_BLOB:
cv = hawk_rtx_makembsval(rtx, data->u.sv.ptr, data->u.sv.len); cv = hawk_rtx_makembsvalwithbchars(rtx, data->u.sv.ptr, data->u.sv.len);
break; break;
default: default: