diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-09-13 21:08:09 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-09-14 09:05:32 +0900 |
| commit | 34cdff5ee4eab5d2da767b9fb7ddb7a42f8c8334 (patch) | |
| tree | 5e2d0e429ce53ae64c9740cc4ed19764f4f75ddd /src | |
| parent | 5890c7d516de1d2cbd9e577065e3cf81383e09ab (diff) | |
| download | mruby-34cdff5ee4eab5d2da767b9fb7ddb7a42f8c8334.tar.gz mruby-34cdff5ee4eab5d2da767b9fb7ddb7a42f8c8334.zip | |
Use `mrb_equal` instead of `mrb_funcall`.
In the typical case, `mrb_funcall` invocation would be skipped.
Diffstat (limited to 'src')
| -rw-r--r-- | src/range.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/range.c b/src/range.c index 28862d779..97fdcdb97 100644 --- a/src/range.c +++ b/src/range.c @@ -196,7 +196,8 @@ range_eq(mrb_state *mrb, mrb_value range) { struct RRange *rr; struct RRange *ro; - mrb_value obj, v1, v2; + mrb_value obj; + mrb_bool v1, v2; mrb_get_args(mrb, "o", &obj); @@ -207,9 +208,9 @@ range_eq(mrb_state *mrb, mrb_value range) rr = mrb_range_ptr(mrb, range); ro = mrb_range_ptr(mrb, obj); - v1 = mrb_funcall(mrb, RANGE_BEG(rr), "==", 1, RANGE_BEG(ro)); - v2 = mrb_funcall(mrb, RANGE_END(rr), "==", 1, RANGE_END(ro)); - if (!mrb_bool(v1) || !mrb_bool(v2) || RANGE_EXCL(rr) != RANGE_EXCL(ro)) { + v1 = mrb_equal(mrb, RANGE_BEG(rr), RANGE_BEG(ro)); + v2 = mrb_equal(mrb, RANGE_END(rr), RANGE_END(ro)); + if (!v1 || !v2 || RANGE_EXCL(rr) != RANGE_EXCL(ro)) { return mrb_false_value(); } return mrb_true_value(); |
