1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* enum.c (enum_inject): default the result value to Qundef to use

first element as initial value if not given.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2005-06-09 14:36:02 +00:00
parent 27c228d681
commit 3f12095fbf
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Thu Jun 9 23:35:22 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* enum.c (enum_inject): default the result value to Qundef to use
first element as initial value if not given.
Thu Jun 9 19:55:41 2005 Tanaka Akira <akr@m17n.org>
* eval.c (ruby_longjmp): new macro to call longjmp, setcontext, etc.

4
enum.c
View file

@ -305,8 +305,10 @@ enum_inject(argc, argv, obj)
{
VALUE memo = Qundef;
rb_scan_args(argc, argv, "01", &memo);
if (rb_scan_args(argc, argv, "01", &memo) == 0)
memo = Qundef;
rb_iterate(rb_each, obj, inject_i, (VALUE)&memo);
if (memo == Qundef) return Qnil;
return memo;
}