Commit e72e8f3a authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

jscript: Don't use iface_to_jsdisp where it's not necessary to grab it.

parent 0e9d2215
...@@ -1663,9 +1663,8 @@ static HRESULT ArrayConstr_isArray(script_ctx_t *ctx, jsval_t vthis, WORD flags, ...@@ -1663,9 +1663,8 @@ static HRESULT ArrayConstr_isArray(script_ctx_t *ctx, jsval_t vthis, WORD flags,
return S_OK; return S_OK;
} }
obj = iface_to_jsdisp(get_object(argv[0])); obj = to_jsdisp(get_object(argv[0]));
if(r) *r = jsval_bool(obj && is_class(obj, JSCLASS_ARRAY)); if(r) *r = jsval_bool(obj && is_class(obj, JSCLASS_ARRAY));
if(obj) jsdisp_release(obj);
return S_OK; return S_OK;
} }
......
...@@ -101,10 +101,9 @@ static inline BOOL is_function_prop(dispex_prop_t *prop) ...@@ -101,10 +101,9 @@ static inline BOOL is_function_prop(dispex_prop_t *prop)
if (is_object_instance(prop->u.val)) if (is_object_instance(prop->u.val))
{ {
jsdisp_t *jsdisp = iface_to_jsdisp(get_object(prop->u.val)); jsdisp_t *jsdisp = to_jsdisp(get_object(prop->u.val));
if (jsdisp) ret = is_class(jsdisp, JSCLASS_FUNCTION); if (jsdisp) ret = is_class(jsdisp, JSCLASS_FUNCTION);
jsdisp_release(jsdisp);
} }
return ret; return ret;
} }
......
...@@ -514,12 +514,9 @@ static HRESULT disp_get_id(script_ctx_t *ctx, IDispatch *disp, const WCHAR *name ...@@ -514,12 +514,9 @@ static HRESULT disp_get_id(script_ctx_t *ctx, IDispatch *disp, const WCHAR *name
BSTR bstr; BSTR bstr;
HRESULT hres; HRESULT hres;
jsdisp = iface_to_jsdisp(disp); jsdisp = to_jsdisp(disp);
if(jsdisp) { if(jsdisp)
hres = jsdisp_get_id(jsdisp, name, flags, id); return jsdisp_get_id(jsdisp, name, flags, id);
jsdisp_release(jsdisp);
return hres;
}
if(name_bstr) { if(name_bstr) {
bstr = name_bstr; bstr = name_bstr;
...@@ -1771,7 +1768,7 @@ static HRESULT interp_obj_prop(script_ctx_t *ctx) ...@@ -1771,7 +1768,7 @@ static HRESULT interp_obj_prop(script_ctx_t *ctx)
jsdisp_t *func; jsdisp_t *func;
assert(is_object_instance(val)); assert(is_object_instance(val));
func = iface_to_jsdisp(get_object(val)); func = to_jsdisp(get_object(val));
desc.mask = desc.flags; desc.mask = desc.flags;
if(type == PROPERTY_DEFINITION_GETTER) { if(type == PROPERTY_DEFINITION_GETTER) {
...@@ -1783,7 +1780,6 @@ static HRESULT interp_obj_prop(script_ctx_t *ctx) ...@@ -1783,7 +1780,6 @@ static HRESULT interp_obj_prop(script_ctx_t *ctx)
} }
hres = jsdisp_define_property(obj, name, &desc); hres = jsdisp_define_property(obj, name, &desc);
jsdisp_release(func);
} }
jsval_release(val); jsval_release(val);
...@@ -1927,15 +1923,12 @@ static HRESULT interp_instanceof(script_ctx_t *ctx) ...@@ -1927,15 +1923,12 @@ static HRESULT interp_instanceof(script_ctx_t *ctx)
hres = JS_E_OBJECT_EXPECTED; hres = JS_E_OBJECT_EXPECTED;
else if(is_object_instance(prot)) { else if(is_object_instance(prot)) {
if(is_object_instance(v)) if(is_object_instance(v))
tmp = iface_to_jsdisp(get_object(v)); tmp = to_jsdisp(get_object(v));
for(iter = tmp; !ret && iter; iter = iter->prototype) { for(iter = tmp; !ret && iter; iter = iter->prototype) {
hres = disp_cmp(get_object(prot), to_disp(iter), &ret); hres = disp_cmp(get_object(prot), to_disp(iter), &ret);
if(FAILED(hres)) if(FAILED(hres))
break; break;
} }
if(tmp)
jsdisp_release(tmp);
}else { }else {
FIXME("prototype is not an object\n"); FIXME("prototype is not an object\n");
hres = E_FAIL; hres = E_FAIL;
...@@ -2221,9 +2214,8 @@ static HRESULT typeof_string(jsval_t v, const WCHAR **ret) ...@@ -2221,9 +2214,8 @@ static HRESULT typeof_string(jsval_t v, const WCHAR **ret)
case JSV_OBJECT: { case JSV_OBJECT: {
jsdisp_t *dispex; jsdisp_t *dispex;
if((dispex = iface_to_jsdisp(get_object(v)))) { if((dispex = to_jsdisp(get_object(v)))) {
*ret = is_class(dispex, JSCLASS_FUNCTION) ? L"function" : L"object"; *ret = is_class(dispex, JSCLASS_FUNCTION) ? L"function" : L"object";
jsdisp_release(dispex);
}else { }else {
*ret = L"object"; *ret = L"object";
} }
......
...@@ -754,14 +754,13 @@ static HRESULT stringify(stringify_ctx_t *ctx, jsdisp_t *object, const WCHAR *na ...@@ -754,14 +754,13 @@ static HRESULT stringify(stringify_ctx_t *ctx, jsdisp_t *object, const WCHAR *na
jsdisp_t *obj; jsdisp_t *obj;
DISPID id; DISPID id;
obj = iface_to_jsdisp(get_object(value)); obj = to_jsdisp(get_object(value));
if(!obj) { if(!obj) {
jsval_release(value); jsval_release(value);
return S_FALSE; return S_FALSE;
} }
hres = jsdisp_get_id(obj, L"toJSON", 0, &id); hres = jsdisp_get_id(obj, L"toJSON", 0, &id);
jsdisp_release(obj);
if(hres == S_OK) if(hres == S_OK)
FIXME("Use toJSON.\n"); FIXME("Use toJSON.\n");
} }
......
...@@ -666,17 +666,14 @@ HRESULT create_regexp_var(script_ctx_t *ctx, jsval_t src_arg, jsval_t *flags_arg ...@@ -666,17 +666,14 @@ HRESULT create_regexp_var(script_ctx_t *ctx, jsval_t src_arg, jsval_t *flags_arg
if(is_object_instance(src_arg)) { if(is_object_instance(src_arg)) {
jsdisp_t *obj; jsdisp_t *obj;
obj = iface_to_jsdisp(get_object(src_arg)); obj = to_jsdisp(get_object(src_arg));
if(obj) { if(obj) {
if(is_class(obj, JSCLASS_REGEXP)) { if(is_class(obj, JSCLASS_REGEXP)) {
RegExpInstance *regexp = regexp_from_jsdisp(obj); RegExpInstance *regexp = regexp_from_jsdisp(obj);
hres = create_regexp(ctx, regexp->str, regexp->jsregexp->flags, ret); hres = create_regexp(ctx, regexp->str, regexp->jsregexp->flags, ret);
jsdisp_release(obj);
return hres; return hres;
} }
jsdisp_release(obj);
} }
} }
...@@ -913,21 +910,16 @@ static HRESULT RegExpConstr_value(script_ctx_t *ctx, jsval_t vthis, WORD flags, ...@@ -913,21 +910,16 @@ static HRESULT RegExpConstr_value(script_ctx_t *ctx, jsval_t vthis, WORD flags,
case DISPATCH_METHOD: case DISPATCH_METHOD:
if(argc) { if(argc) {
if(is_object_instance(argv[0])) { if(is_object_instance(argv[0])) {
jsdisp_t *jsdisp = iface_to_jsdisp(get_object(argv[0])); jsdisp_t *jsdisp = to_jsdisp(get_object(argv[0]));
if(jsdisp) { if(jsdisp) {
if(is_class(jsdisp, JSCLASS_REGEXP)) { if(is_class(jsdisp, JSCLASS_REGEXP)) {
if(argc > 1 && !is_undefined(argv[1])) { if(argc > 1 && !is_undefined(argv[1]))
jsdisp_release(jsdisp);
return JS_E_REGEXP_SYNTAX; return JS_E_REGEXP_SYNTAX;
}
if(r) if(r)
*r = jsval_obj(jsdisp); *r = jsval_obj(jsdisp_addref(jsdisp));
else
jsdisp_release(jsdisp);
return S_OK; return S_OK;
} }
jsdisp_release(jsdisp);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment