* 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:
parent
27c228d681
commit
3f12095fbf
@ -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>
|
Thu Jun 9 19:55:41 2005 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
* eval.c (ruby_longjmp): new macro to call longjmp, setcontext, etc.
|
* eval.c (ruby_longjmp): new macro to call longjmp, setcontext, etc.
|
||||||
|
4
enum.c
4
enum.c
@ -305,8 +305,10 @@ enum_inject(argc, argv, obj)
|
|||||||
{
|
{
|
||||||
VALUE memo = Qundef;
|
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);
|
rb_iterate(rb_each, obj, inject_i, (VALUE)&memo);
|
||||||
|
if (memo == Qundef) return Qnil;
|
||||||
return memo;
|
return memo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user