ruby-changes:34290
From: nobu <ko1@a...>
Date: Sat, 7 Jun 2014 12:29:09 +0900 (JST)
Subject: [ruby-changes:34290] nobu:r46371 (trunk): digest.c: call to_s once
nobu 2014-06-07 12:29:00 +0900 (Sat, 07 Jun 2014) New Revision: 46371 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46371 Log: digest.c: call to_s once * ext/digest/digest.c (rb_digest_instance_equal): no need to call `to_s` twice. [Bug #9913] Modified files: trunk/ChangeLog trunk/ext/digest/digest.c Index: ChangeLog =================================================================== --- ChangeLog (revision 46370) +++ ChangeLog (revision 46371) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Jun 7 12:28:53 2014 Nobuyoshi Nakada <nobu@r...> + + * ext/digest/digest.c (rb_digest_instance_equal): no need to call + `to_s` twice. [Bug #9913] + Sat Jun 7 11:35:01 2014 Tanaka Akira <akr@f...> * object.c (rb_mod_initialize_clone): Override Kernel#initialize_clone Index: ext/digest/digest.c =================================================================== --- ext/digest/digest.c (revision 46370) +++ ext/digest/digest.c (revision 46371) @@ -370,11 +370,10 @@ rb_digest_instance_equal(VALUE self, VAL https://github.com/ruby/ruby/blob/trunk/ext/digest/digest.c#L370 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 */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/