aboutsummaryrefslogtreecommitdiffstats
path: root/ext/digest
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-07 03:29:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-07 03:29:00 +0000
commit635178762d02f02f8c144629ecb0f15c932a34b3 (patch)
treedde11848c581586d0b4c730b814089fffcf26231 /ext/digest
parent4169440f382eb85b82ea069e0fd3eca1bcb048fb (diff)
downloadruby-635178762d02f02f8c144629ecb0f15c932a34b3.tar.gz
digest.c: call to_s once
* ext/digest/digest.c (rb_digest_instance_equal): no need to call `to_s` twice. [Bug #9913] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/digest')
-rw-r--r--ext/digest/digest.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/digest/digest.c b/ext/digest/digest.c
index 8a53bd2b00..f1592f4725 100644
--- a/ext/digest/digest.c
+++ b/ext/digest/digest.c
@@ -370,11 +370,10 @@ rb_digest_instance_equal(VALUE self, VALUE other)
if (rb_obj_is_kind_of(other, rb_mDigest_Instance) == Qtrue) {
str1 = rb_digest_instance_digest(0, 0, self);
str2 = rb_digest_instance_digest(0, 0, other);
- } else if (!NIL_P(rb_check_string_type(other))) {
- str1 = rb_digest_instance_to_s(self);
- str2 = other;
} else {
- return Qfalse;
+ str1 = rb_digest_instance_to_s(self);
+ str2 = rb_check_string_type(other);
+ if (NIL_P(str2)) return Qfalse;
}
/* never blindly assume that subclass methods return strings */