diff --git a/src/script/stdlib.c b/src/script/stdlib.c index d1be3e6e1..1a739c160 100644 --- a/src/script/stdlib.c +++ b/src/script/stdlib.c @@ -9,11 +9,11 @@ #include #include -struct mScriptCallbackAdapter { +struct mScriptCallbackManager { struct mScriptContext* context; }; -static void _mScriptCallbackAdd(struct mScriptCallbackAdapter* adapter, struct mScriptString* name, struct mScriptValue* fn) { +static void _mScriptCallbackAdd(struct mScriptCallbackManager* adapter, struct mScriptString* name, struct mScriptValue* fn) { if (fn->type->base == mSCRIPT_TYPE_WRAPPER) { fn = mScriptValueUnwrap(fn); } @@ -21,20 +21,20 @@ static void _mScriptCallbackAdd(struct mScriptCallbackAdapter* adapter, struct m mScriptValueDeref(fn); } -mSCRIPT_DECLARE_STRUCT(mScriptCallbackAdapter); -mSCRIPT_DECLARE_STRUCT_VOID_METHOD(mScriptCallbackAdapter, add, _mScriptCallbackAdd, 2, STR, callback, WRAPPER, function); +mSCRIPT_DECLARE_STRUCT(mScriptCallbackManager); +mSCRIPT_DECLARE_STRUCT_VOID_METHOD(mScriptCallbackManager, add, _mScriptCallbackAdd, 2, STR, callback, WRAPPER, function); -mSCRIPT_DEFINE_STRUCT(mScriptCallbackAdapter) +mSCRIPT_DEFINE_STRUCT(mScriptCallbackManager) mSCRIPT_DEFINE_DOCSTRING("Add a callback of the named type") -mSCRIPT_DEFINE_STRUCT_METHOD(mScriptCallbackAdapter, add) +mSCRIPT_DEFINE_STRUCT_METHOD(mScriptCallbackManager, add) mSCRIPT_DEFINE_END; void mScriptContextAttachStdlib(struct mScriptContext* context) { struct mScriptValue* lib; - lib = mScriptValueAlloc(mSCRIPT_TYPE_MS_S(mScriptCallbackAdapter)); - lib->value.opaque = calloc(1, sizeof(struct mScriptCallbackAdapter)); - *(struct mScriptCallbackAdapter*) lib->value.opaque = (struct mScriptCallbackAdapter) { + lib = mScriptValueAlloc(mSCRIPT_TYPE_MS_S(mScriptCallbackManager)); + lib->value.opaque = calloc(1, sizeof(struct mScriptCallbackManager)); + *(struct mScriptCallbackManager*) lib->value.opaque = (struct mScriptCallbackManager) { .context = context }; lib->flags = mSCRIPT_VALUE_FLAG_FREE_BUFFER;