Jacek Caban : jscript: Added get_op_str and get_op_double helpers.
Alexandre Julliard
julliard at winehq.org
Mon May 14 14:26:03 CDT 2012
Module: wine
Branch: master
Commit: 1acb30a52297e500244f2afd4698f817cf2ca854
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1acb30a52297e500244f2afd4698f817cf2ca854
Author: Jacek Caban <jacek at codeweavers.com>
Date: Sat May 12 16:21:56 2012 +0200
jscript: Added get_op_str and get_op_double helpers.
---
dlls/jscript/engine.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index bb42899..fb5c39b 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -566,6 +566,14 @@ static inline unsigned get_op_int(exec_ctx_t *ctx, int i){
return i ? ctx->code->instrs[ctx->ip].arg2.lng : ctx->code->instrs[ctx->ip].arg1.lng;
}
+static inline const WCHAR *get_op_str(exec_ctx_t *ctx, int i){
+ return i ? ctx->code->instrs[ctx->ip].arg2.str : ctx->code->instrs[ctx->ip].arg1.str;
+}
+
+static inline double get_op_double(exec_ctx_t *ctx){
+ return *ctx->code->instrs[ctx->ip].arg1.dbl;
+}
+
/* ECMA-262 3rd Edition 12.2 */
static HRESULT interp_var_set(exec_ctx_t *ctx)
{
@@ -731,7 +739,7 @@ static HRESULT interp_throw_ref(exec_ctx_t *ctx)
static HRESULT interp_throw_type(exec_ctx_t *ctx)
{
const HRESULT hres = get_op_uint(ctx, 0);
- const WCHAR *str = ctx->code->instrs[ctx->ip].arg2.str;
+ const WCHAR *str = get_op_str(ctx, 1);
TRACE("%08x %s\n", hres, debugstr_w(str));
@@ -1176,7 +1184,7 @@ static HRESULT interp_int(exec_ctx_t *ctx)
/* ECMA-262 3rd Edition 7.8.3 */
static HRESULT interp_double(exec_ctx_t *ctx)
{
- const double arg = *ctx->code->instrs[ctx->ip].arg1.dbl;
+ const double arg = get_op_double(ctx);
VARIANT v;
TRACE("%lf\n", arg);
@@ -1189,7 +1197,7 @@ static HRESULT interp_double(exec_ctx_t *ctx)
/* ECMA-262 3rd Edition 7.8.4 */
static HRESULT interp_str(exec_ctx_t *ctx)
{
- const WCHAR *str = ctx->code->instrs[ctx->ip].arg1.str;
+ const WCHAR *str = get_op_str(ctx, 0);
VARIANT v;
TRACE("%s\n", debugstr_w(str));
@@ -1205,7 +1213,7 @@ static HRESULT interp_str(exec_ctx_t *ctx)
/* ECMA-262 3rd Edition 7.8 */
static HRESULT interp_regexp(exec_ctx_t *ctx)
{
- const WCHAR *source = ctx->code->instrs[ctx->ip].arg1.str;
+ const WCHAR *source = get_op_str(ctx, 0);
const unsigned flags = get_op_uint(ctx, 1);
jsdisp_t *regexp;
VARIANT v;
More information about the wine-cvs
mailing list