Skip to content

Commit 848761f

Browse files
committed
Make js_strict_eq accept JSValueConst
This also removes uses of this function internally and replaces it with `js_strict_eq2` instead.
1 parent 0134098 commit 848761f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

quickjs.c

+7-5
Original file line numberDiff line numberDiff line change
@@ -14234,7 +14234,7 @@ static no_inline __exception int js_eq_slow(JSContext *ctx, JSValue *sp,
1423414234
goto exception;
1423514235
}
1423614236
}
14237-
res = js_strict_eq(ctx, op1, op2);
14237+
res = js_strict_eq2(ctx, op1, op2, JS_EQ_STRICT);
1423814238
} else if (tag1 == JS_TAG_BOOL) {
1423914239
op1 = JS_NewInt32(ctx, JS_VALUE_GET_INT(op1));
1424014240
goto redo;
@@ -14552,14 +14552,16 @@ static BOOL js_strict_eq2(JSContext *ctx, JSValue op1, JSValue op2,
1455214552
return res;
1455314553
}
1455414554

14555-
static BOOL js_strict_eq(JSContext *ctx, JSValue op1, JSValue op2)
14555+
static BOOL js_strict_eq(JSContext *ctx, JSValueConst op1, JSValueConst op2)
1455614556
{
14557-
return js_strict_eq2(ctx, op1, op2, JS_EQ_STRICT);
14557+
return js_strict_eq2(ctx,
14558+
JS_DupValue(ctx, op1), JS_DupValue(ctx, op2),
14559+
JS_EQ_STRICT);
1455814560
}
1455914561

1456014562
BOOL JS_StrictEq(JSContext *ctx, JSValueConst op1, JSValueConst op2)
1456114563
{
14562-
return js_strict_eq(ctx, JS_DupValue(ctx, op1), JS_DupValue(ctx, op2));
14564+
return js_strict_eq(ctx, op1, op2);
1456314565
}
1456414566

1456514567
static BOOL js_same_value(JSContext *ctx, JSValueConst op1, JSValueConst op2)
@@ -14590,7 +14592,7 @@ static no_inline int js_strict_eq_slow(JSContext *ctx, JSValue *sp,
1459014592
BOOL is_neq)
1459114593
{
1459214594
BOOL res;
14593-
res = js_strict_eq(ctx, sp[-2], sp[-1]);
14595+
res = js_strict_eq2(ctx, sp[-2], sp[-1], JS_EQ_STRICT);
1459414596
sp[-2] = JS_NewBool(ctx, res ^ is_neq);
1459514597
return 0;
1459614598
}

0 commit comments

Comments
 (0)