added JS_GetAnyOpaque() (oleavr)

This commit is contained in:
Fabrice Bellard
2025-04-07 18:45:11 +02:00
parent 1eb05e44fa
commit 00e6f29b17
2 changed files with 13 additions and 0 deletions

View File

@@ -10208,6 +10208,18 @@ void *JS_GetOpaque2(JSContext *ctx, JSValueConst obj, JSClassID class_id)
return p;
}
void *JS_GetAnyOpaque(JSValueConst obj, JSClassID *class_id)
{
JSObject *p;
if (JS_VALUE_GET_TAG(obj) != JS_TAG_OBJECT) {
*class_id = 0;
return NULL;
}
p = JS_VALUE_GET_OBJ(obj);
*class_id = p->class_id;
return p->u.opaque;
}
static JSValue JS_ToPrimitiveFree(JSContext *ctx, JSValue val, int hint)
{
int i;