summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-03-09 01:27:34 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-03-09 01:27:34 +0900
commit452bf73c2317cc4c9cf69b4dbf3ff82c3bde89c3 (patch)
tree5fb6ec876dee56c557a101e3b94b01635715809b /src
parent6a23be78055555c005a4d57f0643f652ad39aac8 (diff)
parentd7b179475b3dbdc4fa6441a74e97560936e4942e (diff)
downloadmruby-452bf73c2317cc4c9cf69b4dbf3ff82c3bde89c3.tar.gz
mruby-452bf73c2317cc4c9cf69b4dbf3ff82c3bde89c3.zip
Merge pull request #1832 from ksss/fix-1823
fix #1823
Diffstat (limited to 'src')
-rw-r--r--src/hash.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/hash.c b/src/hash.c
index af3571eaf..34cc15131 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -874,6 +874,7 @@ static mrb_value
hash_equal(mrb_state *mrb, mrb_value hash1, mrb_value hash2, mrb_bool eql)
{
khash_t(ht) *h1, *h2;
+ mrb_bool eq;
if (mrb_obj_equal(mrb, hash1, hash2)) return mrb_true_value();
if (!mrb_hash_p(hash2)) {
@@ -881,8 +882,6 @@ hash_equal(mrb_state *mrb, mrb_value hash1, mrb_value hash2, mrb_bool eql)
return mrb_false_value();
}
else {
- mrb_bool eq;
-
if (eql) {
eq = mrb_eql(mrb, hash2, hash1);
}
@@ -908,7 +907,11 @@ hash_equal(mrb_state *mrb, mrb_value hash1, mrb_value hash2, mrb_bool eql)
key = kh_key(h1,k1);
k2 = kh_get(ht, mrb, h2, key);
if (k2 != kh_end(h2)) {
- if (mrb_eql(mrb, kh_value(h1,k1), kh_value(h2,k2))) {
+ if (eql)
+ eq = mrb_eql(mrb, kh_value(h1,k1), kh_value(h2,k2));
+ else
+ eq = mrb_equal(mrb, kh_value(h1,k1), kh_value(h2,k2));
+ if (eq) {
continue; /* next key */
}
}