Module: wine Branch: master Commit: 1a1292833e9deec0462c1d68701a499d621a9cf8 URL: https://source.winehq.org/git/wine.git/?a=commit;h=1a1292833e9deec0462c1d687...
Author: Jacek Caban jacek@codeweavers.com Date: Thu Oct 17 22:46:59 2019 +0200
vbscript: Get rid of no longer needed ITypeInfo in BuiltinDisp.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/vbscript/global.c | 17 +++--------- dlls/vbscript/vbscript.h | 13 --------- dlls/vbscript/vbscript_main.c | 61 ------------------------------------------- 3 files changed, 3 insertions(+), 88 deletions(-)
diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c index 45787f52af..50f54f38a6 100644 --- a/dlls/vbscript/global.c +++ b/dlls/vbscript/global.c @@ -268,8 +268,7 @@ static const IDispatchVtbl BuiltinDispVtbl = { Builtin_Invoke };
-static HRESULT create_builtin_dispatch(script_ctx_t *ctx, const builtin_prop_t *members, size_t member_cnt, - ITypeInfo *typeinfo, BuiltinDisp **ret) +static HRESULT create_builtin_dispatch(script_ctx_t *ctx, const builtin_prop_t *members, size_t member_cnt, BuiltinDisp **ret) { BuiltinDisp *disp;
@@ -281,7 +280,6 @@ static HRESULT create_builtin_dispatch(script_ctx_t *ctx, const builtin_prop_t * disp->members = members; disp->member_cnt = member_cnt; disp->ctx = ctx; - disp->typeinfo = typeinfo;
*ret = disp; return S_OK; @@ -2858,14 +2856,9 @@ void detach_global_objects(script_ctx_t *ctx)
HRESULT init_global(script_ctx_t *ctx) { - ITypeInfo *typeinfo; HRESULT hres;
- hres = get_typeinfo(GlobalObj_tid, &typeinfo); - if(FAILED(hres)) - return hres; - - hres = create_builtin_dispatch(ctx, global_props, ARRAY_SIZE(global_props), typeinfo, &ctx->global_obj); + hres = create_builtin_dispatch(ctx, global_props, ARRAY_SIZE(global_props), &ctx->global_obj); if(FAILED(hres)) return hres;
@@ -2873,9 +2866,5 @@ HRESULT init_global(script_ctx_t *ctx) if(FAILED(hres)) return hres;
- hres = get_typeinfo(ErrObj_tid, &typeinfo); - if(FAILED(hres)) - return hres; - - return create_builtin_dispatch(ctx, err_props, ARRAY_SIZE(err_props), typeinfo, &ctx->err_obj); + return create_builtin_dispatch(ctx, err_props, ARRAY_SIZE(err_props), &ctx->err_obj); } diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index c17084d4ea..71f42aaff9 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -141,7 +141,6 @@ typedef struct { size_t member_cnt; const builtin_prop_t *members; script_ctx_t *ctx; - ITypeInfo *typeinfo; } BuiltinDisp;
HRESULT create_vbdisp(const class_desc_t*,vbdisp_t**) DECLSPEC_HIDDEN; @@ -358,18 +357,6 @@ HRESULT report_script_error(script_ctx_t*) DECLSPEC_HIDDEN; void detach_global_objects(script_ctx_t*) DECLSPEC_HIDDEN; HRESULT get_builtin_id(BuiltinDisp*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
-#define TID_LIST \ - XDIID(ErrObj) \ - XDIID(GlobalObj) - -typedef enum { -#define XDIID(iface) iface ## _tid, -TID_LIST -#undef XDIID - LAST_tid -} tid_t; - -HRESULT get_typeinfo(tid_t,ITypeInfo**) DECLSPEC_HIDDEN; void release_regexp_typelib(void) DECLSPEC_HIDDEN;
static inline BOOL is_int32(double d) diff --git a/dlls/vbscript/vbscript_main.c b/dlls/vbscript/vbscript_main.c index 3a8019a30d..6e6f386755 100644 --- a/dlls/vbscript/vbscript_main.c +++ b/dlls/vbscript/vbscript_main.c @@ -35,66 +35,6 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
static HINSTANCE vbscript_hinstance;
-static ITypeLib *typelib; -static ITypeInfo *typeinfos[LAST_tid]; - -static REFIID tid_ids[] = { -#define XDIID(iface) &DIID_ ## iface, -TID_LIST -#undef XDIID -}; - -HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo) -{ - HRESULT hres; - - if (!typelib) { - ITypeLib *tl; - - static const WCHAR vbscript_dll1W[] = {'v','b','s','c','r','i','p','t','.','d','l','l','\','1',0}; - - hres = LoadTypeLib(vbscript_dll1W, &tl); - if(FAILED(hres)) { - ERR("LoadRegTypeLib failed: %08x\n", hres); - return hres; - } - - if(InterlockedCompareExchangePointer((void**)&typelib, tl, NULL)) - ITypeLib_Release(tl); - } - - if(!typeinfos[tid]) { - ITypeInfo *ti; - - hres = ITypeLib_GetTypeInfoOfGuid(typelib, tid_ids[tid], &ti); - if(FAILED(hres)) { - ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_ids[tid]), hres); - return hres; - } - - if(InterlockedCompareExchangePointer((void**)(typeinfos+tid), ti, NULL)) - ITypeInfo_Release(ti); - } - - *typeinfo = typeinfos[tid]; - return S_OK; -} - -static void release_typelib(void) -{ - unsigned i; - - if(!typelib) - return; - - for(i = 0; i < ARRAY_SIZE(typeinfos); i++) { - if(typeinfos[i]) - ITypeInfo_Release(typeinfos[i]); - } - - ITypeLib_Release(typelib); -} - BSTR get_vbscript_string(int id) { WCHAR buf[512]; @@ -316,7 +256,6 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) break; case DLL_PROCESS_DETACH: if (lpv) break; - release_typelib(); release_regexp_typelib(); }