From 412b023742171585b123cf20fcbb9b94476582ac Mon Sep 17 00:00:00 2001 From: mame Date: Thu, 15 Nov 2012 13:50:55 +0000 Subject: * range.c (range_bsearch): fix some bugs: a documentation bug, a wrong condition, missed break in switch/case, and workaround for GCC optimization. See [ruby-core:49364] in detail. A great patch from Heesob Park. [Bug #7352] [Feature #4766] * array.c (rb_ary_bsearch): fix similar bug (missed break). * test/ruby/test_range.rb: add two test cases for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'array.c') diff --git a/array.c b/array.c index 4fce3285f5..25fd829aa9 100644 --- a/array.c +++ b/array.c @@ -2451,7 +2451,7 @@ rb_ary_bsearch(VALUE ary) else if (rb_obj_is_kind_of(v, rb_cNumeric)) { switch (rb_cmpint(rb_funcall(v, id_cmp, 1, INT2FIX(0)), v, INT2FIX(0))) { case 0: return val; - case 1: smaller = 1; + case 1: smaller = 1; break; case -1: smaller = 0; } } -- cgit v1.2.3