This commit is contained in:
parent
9fa26924c7
commit
ebfdb71044
@ -2854,6 +2854,7 @@ done:
|
||||
/* ------------------------------------------------------------ */
|
||||
|
||||
/*
|
||||
BEGIN {
|
||||
if (sys::getnwifcfg("eth0", sys::NWIFCFG_IN6, x) >= 0)
|
||||
{
|
||||
for (i in x) print i, x[i];
|
||||
@ -2862,6 +2863,7 @@ done:
|
||||
{
|
||||
print "Error:", sys::errmsg();
|
||||
}
|
||||
}
|
||||
*/
|
||||
static int fnc_getifcfg (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
|
||||
{
|
||||
|
20
lib/val.c
20
lib/val.c
@ -64,7 +64,7 @@ BEGIN {
|
||||
for (i = 1; i < 10; i++) a[i] = i;
|
||||
a[11] = a;
|
||||
a[12] = a;
|
||||
a = nil;
|
||||
a = @nil;
|
||||
b[1] = a;
|
||||
c[1] = 0;
|
||||
}
|
||||
@ -81,7 +81,7 @@ BEGIN {
|
||||
a[13] = "hello";
|
||||
j[3] = a;
|
||||
a[14] = j;
|
||||
a = nil;
|
||||
a = @nil;
|
||||
b[1] = a;
|
||||
c[1] = 0;
|
||||
}
|
||||
@ -98,7 +98,7 @@ BEGIN {
|
||||
a[13] = "hello";
|
||||
j[3] = a;
|
||||
a[14] = j;
|
||||
a = nil;
|
||||
a = @nil;
|
||||
b[1] = a;
|
||||
c[1] = 0;
|
||||
}
|
||||
@ -115,8 +115,8 @@ BEGIN {
|
||||
a[13] = "hello";
|
||||
j[3] = a;
|
||||
a[14] = j;
|
||||
a = nil;
|
||||
j = nil;
|
||||
a = @nil;
|
||||
j = @nil; hawk::gc();
|
||||
b[1] = a;
|
||||
c[1] = 0;
|
||||
}
|
||||
@ -1135,7 +1135,7 @@ retry:
|
||||
|
||||
#if defined(HAWK_ENABLE_GC)
|
||||
gc_chain_val (&rtx->gc.g[0], (hawk_val_t*)val);
|
||||
val->v_gc = 1;
|
||||
val->v_gc = 1; /* only array and map are to be garbaged collected as of now */
|
||||
#if defined(DEBUG_GC)
|
||||
hawk_logbfmt (hawk_rtx_gethawk(rtx), HAWK_LOG_STDERR, "[GC] MADE GCH %p VAL(ARR) %p\n", hawk_val_to_gch(val), val);
|
||||
#endif
|
||||
@ -1242,7 +1242,7 @@ retry:
|
||||
|
||||
#if defined(HAWK_ENABLE_GC)
|
||||
gc_chain_val (&rtx->gc.g[0], (hawk_val_t*)val);
|
||||
val->v_gc = 1;
|
||||
val->v_gc = 1; /* only array and map are to be garbaged collected as of now */
|
||||
#if defined(DEBUG_GC)
|
||||
hawk_logbfmt (hawk_rtx_gethawk(rtx), HAWK_LOG_STDERR, "[GC] MADE GCH %p VAL(MAP) %p\n", hawk_val_to_gch(val), val);
|
||||
#endif
|
||||
@ -1260,6 +1260,8 @@ hawk_val_t* hawk_rtx_makemapvalwithdata (hawk_rtx_t* rtx, hawk_val_map_data_t da
|
||||
map = hawk_rtx_makemapval(rtx);
|
||||
if (HAWK_UNLIKELY(!map)) return HAWK_NULL;
|
||||
|
||||
hawk_rtx_refupval (rtx, map);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
hawk_val_map_data_t* p;
|
||||
@ -1325,11 +1327,13 @@ hawk_val_t* hawk_rtx_makemapvalwithdata (hawk_rtx_t* rtx, hawk_val_map_data_t da
|
||||
if (tmp == HAWK_NULL || hawk_rtx_setmapvalfld(rtx, map, p->key.ptr, p->key.len, tmp) == HAWK_NULL)
|
||||
{
|
||||
if (tmp) hawk_rtx_freeval (rtx, tmp, HAWK_RTX_FREEVAL_CACHE);
|
||||
hawk_rtx_freeval (rtx, map, HAWK_RTX_FREEVAL_CACHE);
|
||||
hawk_rtx_refdownval (rtx, map);
|
||||
return HAWK_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
hawk_rtx_refdownval_nofree (rtx, map);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
@ -566,6 +566,8 @@ static int getoption_byid (hawk_rtx_t* rtx, uctx_list_t* list, hawk_int_t id, ha
|
||||
if (map)
|
||||
{
|
||||
count = 1;
|
||||
hawk_rtx_refupval (rtx, map);
|
||||
|
||||
uci_foreach_element(&uo->v.list, tmp)
|
||||
{
|
||||
const hawk_oocs_t* subsep;
|
||||
@ -577,13 +579,13 @@ static int getoption_byid (hawk_rtx_t* rtx, uctx_list_t* list, hawk_int_t id, ha
|
||||
fld = hawk_rtx_makestrvalwithbcstr(rtx, tmp->name);
|
||||
if (!fld)
|
||||
{
|
||||
hawk_rtx_refupval (rtx, map);
|
||||
hawk_rtx_refdownval (rtx, map);
|
||||
map = HAWK_NULL;
|
||||
x = UCI_ERR_MEM;
|
||||
break;
|
||||
}
|
||||
|
||||
hawk_rtx_refupval (rtx, fld);
|
||||
subsep = hawk_rtx_getsubsep(rtx);
|
||||
|
||||
k[0].ptr = HAWK_T("value");
|
||||
@ -599,9 +601,7 @@ static int getoption_byid (hawk_rtx_t* rtx, uctx_list_t* list, hawk_int_t id, ha
|
||||
if (!kp || hawk_rtx_setmapvalfld(rtx, map, kp, kl, fld) == HAWK_NULL)
|
||||
{
|
||||
if (kp) hawk_rtx_freemem (rtx, kp);
|
||||
hawk_rtx_refupval (rtx, fld);
|
||||
hawk_rtx_refdownval (rtx, fld);
|
||||
hawk_rtx_refupval (rtx, map);
|
||||
hawk_rtx_refdownval (rtx, map);
|
||||
map = HAWK_NULL;
|
||||
x = UCI_ERR_MEM;
|
||||
@ -609,15 +609,17 @@ static int getoption_byid (hawk_rtx_t* rtx, uctx_list_t* list, hawk_int_t id, ha
|
||||
}
|
||||
|
||||
hawk_rtx_freemem (rtx, kp);
|
||||
hawk_rtx_refdownval (rtx, fld);
|
||||
count++;
|
||||
}
|
||||
|
||||
if (map)
|
||||
{
|
||||
if (hawk_rtx_setrefval(rtx, ref, map) <= -1)
|
||||
{
|
||||
hawk_rtx_refupval (rtx, map);
|
||||
int n;
|
||||
n = hawk_rtx_setrefval(rtx, ref, map);
|
||||
hawk_rtx_refdownval (rtx, map);
|
||||
if (n <= -1)
|
||||
{
|
||||
map = HAWK_NULL;
|
||||
return -9999;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user