mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* enum.c (enum_minmax): fix SEGV by [].minmax.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3f2fe37200
commit
1fb587ddec
2 changed files with 9 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Sun Jun 24 03:05:00 2007 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* enum.c (enum_minmax): fix SEGV by [].minmax.
|
||||||
|
|
||||||
Sat Jun 23 17:18:19 2007 Tanaka Akira <akr@fsij.org>
|
Sat Jun 23 17:18:19 2007 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* re.c (match_inspect): MatchData#inspect implemented.
|
* re.c (match_inspect): MatchData#inspect implemented.
|
||||||
|
|
3
enum.c
3
enum.c
|
@ -1126,8 +1126,10 @@ enum_minmax(VALUE obj)
|
||||||
else {
|
else {
|
||||||
rb_block_call(obj, id_each, 0, 0, minmax_i, (VALUE)result);
|
rb_block_call(obj, id_each, 0, 0, minmax_i, (VALUE)result);
|
||||||
}
|
}
|
||||||
|
if (result[0] != Qundef) {
|
||||||
RARRAY_PTR(ary)[0] = result[0];
|
RARRAY_PTR(ary)[0] = result[0];
|
||||||
RARRAY_PTR(ary)[1] = result[1];
|
RARRAY_PTR(ary)[1] = result[1];
|
||||||
|
}
|
||||||
return ary;
|
return ary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1563,6 +1565,7 @@ Init_Enumerable(void)
|
||||||
rb_define_method(rb_mEnumerable,"max", enum_max, 0);
|
rb_define_method(rb_mEnumerable,"max", enum_max, 0);
|
||||||
rb_define_method(rb_mEnumerable,"minmax", enum_minmax, 0);
|
rb_define_method(rb_mEnumerable,"minmax", enum_minmax, 0);
|
||||||
rb_define_method(rb_mEnumerable,"min_by", enum_min_by, 0);
|
rb_define_method(rb_mEnumerable,"min_by", enum_min_by, 0);
|
||||||
|
rb_define_method(rb_mEnumerable,"max_by", enum_max_by, 0);
|
||||||
rb_define_method(rb_mEnumerable,"minmax_by", enum_minmax_by, 0);
|
rb_define_method(rb_mEnumerable,"minmax_by", enum_minmax_by, 0);
|
||||||
rb_define_method(rb_mEnumerable,"member?", enum_member, 1);
|
rb_define_method(rb_mEnumerable,"member?", enum_member, 1);
|
||||||
rb_define_method(rb_mEnumerable,"include?", enum_member, 1);
|
rb_define_method(rb_mEnumerable,"include?", enum_member, 1);
|
||||||
|
|
Loading…
Reference in a new issue