Jacek Caban : jscript: Move value_proc to BuiltinFunction struct.

Alexandre Julliard julliard at winehq.org
Wed Aug 14 20:17:23 CDT 2019


Module: wine
Branch: master
Commit: 2204c06909a8a0e8ecf498c2122ae4f4b80476ee
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=2204c06909a8a0e8ecf498c2122ae4f4b80476ee

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Aug 14 13:18:21 2019 +0200

jscript: Move value_proc to BuiltinFunction struct.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/jscript/function.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c
index d4b3473..79f1153 100644
--- a/dlls/jscript/function.c
+++ b/dlls/jscript/function.c
@@ -30,7 +30,6 @@ typedef struct _function_vtbl_t function_vtbl_t;
 typedef struct {
     jsdisp_t dispex;
     const function_vtbl_t *vtbl;
-    builtin_invoke_t value_proc;
     const WCHAR *name;
     DWORD flags;
     scope_chain_t *scope_chain;
@@ -47,6 +46,7 @@ struct _function_vtbl_t {
 
 typedef struct {
     FunctionInstance function;
+    builtin_invoke_t proc;
 } NativeFunction;
 
 typedef struct {
@@ -541,9 +541,10 @@ static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_
     return S_OK;
 }
 
-static HRESULT NativeFunction_call(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_disp, unsigned flags,
+static HRESULT NativeFunction_call(script_ctx_t *ctx, FunctionInstance *func, IDispatch *this_disp, unsigned flags,
         unsigned argc, jsval_t *argv, jsval_t *r)
 {
+    NativeFunction *function = (NativeFunction*)func;
     vdisp_t vthis;
     HRESULT hres;
 
@@ -554,7 +555,7 @@ static HRESULT NativeFunction_call(script_ctx_t *ctx, FunctionInstance *function
     else
         set_jsdisp(&vthis, ctx->global);
 
-    hres = function->value_proc(ctx, &vthis, flags & ~DISPATCH_JSCRIPT_INTERNAL_MASK, argc, argv, r);
+    hres = function->proc(ctx, &vthis, flags & ~DISPATCH_JSCRIPT_INTERNAL_MASK, argc, argv, r);
 
     vdisp_release(&vthis);
     return hres;
@@ -598,7 +599,7 @@ static const function_vtbl_t NativeFunctionVtbl = {
 HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name,
         const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
 {
-    FunctionInstance *function;
+    NativeFunction *function;
     HRESULT hres;
 
     hres = create_function(ctx, builtin_info, &NativeFunctionVtbl, sizeof(NativeFunction), flags, FALSE, NULL, (void**)&function);
@@ -606,19 +607,19 @@ HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc,
         return hres;
 
     if(builtin_info)
-        hres = jsdisp_define_data_property(&function->dispex, lengthW, 0,
-                                           jsval_number(function->length));
+        hres = jsdisp_define_data_property(&function->function.dispex, lengthW, 0,
+                                           jsval_number(function->function.length));
     if(SUCCEEDED(hres))
-        hres = jsdisp_define_data_property(&function->dispex, prototypeW, 0, jsval_obj(prototype));
+        hres = jsdisp_define_data_property(&function->function.dispex, prototypeW, 0, jsval_obj(prototype));
     if(FAILED(hres)) {
-        jsdisp_release(&function->dispex);
+        jsdisp_release(&function->function.dispex);
         return hres;
     }
 
-    function->value_proc = value_proc;
-    function->name = name;
+    function->proc = value_proc;
+    function->function.name = name;
 
-    *ret = &function->dispex;
+    *ret = &function->function.dispex;
     return S_OK;
 }
 
@@ -873,13 +874,13 @@ HRESULT init_function_constr(script_ctx_t *ctx, jsdisp_t *object_prototype)
     if(FAILED(hres))
         return hres;
 
-    prot->function.value_proc = FunctionProt_value;
+    prot->proc = FunctionProt_value;
     prot->function.name = prototypeW;
 
     hres = create_function(ctx, &FunctionInst_info, &NativeFunctionVtbl, sizeof(NativeFunction), PROPF_CONSTR|1,
                            TRUE, &prot->function.dispex, (void**)&constr);
     if(SUCCEEDED(hres)) {
-        constr->function.value_proc = FunctionConstr_value;
+        constr->proc = FunctionConstr_value;
         constr->function.name = FunctionW;
         hres = jsdisp_define_data_property(&constr->function.dispex, prototypeW, 0, jsval_obj(&prot->function.dispex));
         if(SUCCEEDED(hres))




More information about the wine-cvs mailing list