mirror of
https://github.com/bellard/quickjs.git
synced 2025-09-30 06:54:26 +03:00
export JS_FreePropertyEnum()
This commit is contained in:
44
quickjs.c
44
quickjs.c
@@ -7875,7 +7875,7 @@ static int num_keys_cmp(const void *p1, const void *p2, void *opaque)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void js_free_prop_enum(JSContext *ctx, JSPropertyEnum *tab, uint32_t len)
|
||||
void JS_FreePropertyEnum(JSContext *ctx, JSPropertyEnum *tab, uint32_t len)
|
||||
{
|
||||
uint32_t i;
|
||||
if (tab) {
|
||||
@@ -7969,7 +7969,7 @@ static int __exception JS_GetOwnPropertyNamesInternal(JSContext *ctx,
|
||||
/* set the "is_enumerable" field if necessary */
|
||||
res = JS_GetOwnPropertyInternal(ctx, &desc, p, atom);
|
||||
if (res < 0) {
|
||||
js_free_prop_enum(ctx, tab_exotic, exotic_count);
|
||||
JS_FreePropertyEnum(ctx, tab_exotic, exotic_count);
|
||||
return -1;
|
||||
}
|
||||
if (res) {
|
||||
@@ -8000,7 +8000,7 @@ static int __exception JS_GetOwnPropertyNamesInternal(JSContext *ctx,
|
||||
if (atom_count < exotic_keys_count || atom_count > INT32_MAX) {
|
||||
add_overflow:
|
||||
JS_ThrowOutOfMemory(ctx);
|
||||
js_free_prop_enum(ctx, tab_exotic, exotic_count);
|
||||
JS_FreePropertyEnum(ctx, tab_exotic, exotic_count);
|
||||
return -1;
|
||||
}
|
||||
/* XXX: need generic way to test for js_malloc(ctx, a * b) overflow */
|
||||
@@ -8008,7 +8008,7 @@ static int __exception JS_GetOwnPropertyNamesInternal(JSContext *ctx,
|
||||
/* avoid allocating 0 bytes */
|
||||
tab_atom = js_malloc(ctx, sizeof(tab_atom[0]) * max_int(atom_count, 1));
|
||||
if (!tab_atom) {
|
||||
js_free_prop_enum(ctx, tab_exotic, exotic_count);
|
||||
JS_FreePropertyEnum(ctx, tab_exotic, exotic_count);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -8053,7 +8053,7 @@ static int __exception JS_GetOwnPropertyNamesInternal(JSContext *ctx,
|
||||
for(i = 0; i < len; i++) {
|
||||
tab_atom[num_index].atom = __JS_AtomFromUInt32(i);
|
||||
if (tab_atom[num_index].atom == JS_ATOM_NULL) {
|
||||
js_free_prop_enum(ctx, tab_atom, num_index);
|
||||
JS_FreePropertyEnum(ctx, tab_atom, num_index);
|
||||
return -1;
|
||||
}
|
||||
tab_atom[num_index].is_enumerable = TRUE;
|
||||
@@ -15553,7 +15553,7 @@ static __exception int js_for_in_prepare_prototype_chain_enum(JSContext *ctx,
|
||||
JS_FreeValue(ctx, obj1);
|
||||
goto fail;
|
||||
}
|
||||
js_free_prop_enum(ctx, tab_atom, tab_atom_count);
|
||||
JS_FreePropertyEnum(ctx, tab_atom, tab_atom_count);
|
||||
if (tab_atom_count != 0) {
|
||||
JS_FreeValue(ctx, obj1);
|
||||
goto slow_path;
|
||||
@@ -15637,7 +15637,7 @@ static __exception int js_for_in_next(JSContext *ctx, JSValue *sp)
|
||||
JS_GPN_STRING_MASK | JS_GPN_SET_ENUM)) {
|
||||
return -1;
|
||||
}
|
||||
js_free_prop_enum(ctx, it->tab_atom, it->atom_count);
|
||||
JS_FreePropertyEnum(ctx, it->tab_atom, it->atom_count);
|
||||
it->tab_atom = tab_atom;
|
||||
it->atom_count = tab_atom_count;
|
||||
it->idx = 0;
|
||||
@@ -16160,10 +16160,10 @@ static __exception int JS_CopyDataProperties(JSContext *ctx,
|
||||
if (ret < 0)
|
||||
goto exception;
|
||||
}
|
||||
js_free_prop_enum(ctx, tab_atom, tab_atom_count);
|
||||
JS_FreePropertyEnum(ctx, tab_atom, tab_atom_count);
|
||||
return 0;
|
||||
exception:
|
||||
js_free_prop_enum(ctx, tab_atom, tab_atom_count);
|
||||
JS_FreePropertyEnum(ctx, tab_atom, tab_atom_count);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -38093,7 +38093,7 @@ static __exception int JS_ObjectDefineProperties(JSContext *ctx,
|
||||
ret = 0;
|
||||
|
||||
exception:
|
||||
js_free_prop_enum(ctx, atoms, len);
|
||||
JS_FreePropertyEnum(ctx, atoms, len);
|
||||
JS_FreeValue(ctx, props);
|
||||
JS_FreeValue(ctx, desc);
|
||||
return ret;
|
||||
@@ -38364,12 +38364,12 @@ static JSValue js_object_getOwnPropertyDescriptors(JSContext *ctx, JSValueConst
|
||||
goto exception;
|
||||
}
|
||||
}
|
||||
js_free_prop_enum(ctx, props, len);
|
||||
JS_FreePropertyEnum(ctx, props, len);
|
||||
JS_FreeValue(ctx, obj);
|
||||
return r;
|
||||
|
||||
exception:
|
||||
js_free_prop_enum(ctx, props, len);
|
||||
JS_FreePropertyEnum(ctx, props, len);
|
||||
JS_FreeValue(ctx, obj);
|
||||
JS_FreeValue(ctx, r);
|
||||
return JS_EXCEPTION;
|
||||
@@ -38449,7 +38449,7 @@ exception:
|
||||
JS_FreeValue(ctx, r);
|
||||
r = JS_EXCEPTION;
|
||||
done:
|
||||
js_free_prop_enum(ctx, atoms, len);
|
||||
JS_FreePropertyEnum(ctx, atoms, len);
|
||||
JS_FreeValue(ctx, obj);
|
||||
return r;
|
||||
}
|
||||
@@ -38710,11 +38710,11 @@ static JSValue js_object_seal(JSContext *ctx, JSValueConst this_val,
|
||||
JS_UNDEFINED, JS_UNDEFINED, desc_flags) < 0)
|
||||
goto exception;
|
||||
}
|
||||
js_free_prop_enum(ctx, props, len);
|
||||
JS_FreePropertyEnum(ctx, props, len);
|
||||
return JS_DupValue(ctx, obj);
|
||||
|
||||
exception:
|
||||
js_free_prop_enum(ctx, props, len);
|
||||
JS_FreePropertyEnum(ctx, props, len);
|
||||
return JS_EXCEPTION;
|
||||
}
|
||||
|
||||
@@ -38756,11 +38756,11 @@ static JSValue js_object_isSealed(JSContext *ctx, JSValueConst this_val,
|
||||
return JS_EXCEPTION;
|
||||
res ^= 1;
|
||||
done:
|
||||
js_free_prop_enum(ctx, props, len);
|
||||
JS_FreePropertyEnum(ctx, props, len);
|
||||
return JS_NewBool(ctx, res);
|
||||
|
||||
exception:
|
||||
js_free_prop_enum(ctx, props, len);
|
||||
JS_FreePropertyEnum(ctx, props, len);
|
||||
return JS_EXCEPTION;
|
||||
}
|
||||
|
||||
@@ -46089,7 +46089,7 @@ static JSValue internalize_json_property(JSContext *ctx, JSValueConst holder,
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
js_free_prop_enum(ctx, atoms, len);
|
||||
JS_FreePropertyEnum(ctx, atoms, len);
|
||||
atoms = NULL;
|
||||
name_val = JS_AtomToValue(ctx, name);
|
||||
if (JS_IsException(name_val))
|
||||
@@ -46101,7 +46101,7 @@ static JSValue internalize_json_property(JSContext *ctx, JSValueConst holder,
|
||||
JS_FreeValue(ctx, val);
|
||||
return res;
|
||||
fail:
|
||||
js_free_prop_enum(ctx, atoms, len);
|
||||
JS_FreePropertyEnum(ctx, atoms, len);
|
||||
JS_FreeValue(ctx, val);
|
||||
return JS_EXCEPTION;
|
||||
}
|
||||
@@ -47475,14 +47475,14 @@ static int js_proxy_get_own_property_names(JSContext *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
js_free_prop_enum(ctx, tab2, len2);
|
||||
JS_FreePropertyEnum(ctx, tab2, len2);
|
||||
JS_FreeValue(ctx, prop_array);
|
||||
*ptab = tab;
|
||||
*plen = len;
|
||||
return 0;
|
||||
fail:
|
||||
js_free_prop_enum(ctx, tab2, len2);
|
||||
js_free_prop_enum(ctx, tab, len);
|
||||
JS_FreePropertyEnum(ctx, tab2, len2);
|
||||
JS_FreePropertyEnum(ctx, tab, len);
|
||||
JS_FreeValue(ctx, prop_array);
|
||||
return -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user