ruby-changes:53582
From: shyouhei <ko1@a...>
Date: Mon, 19 Nov 2018 15:48:15 +0900 (JST)
Subject: [ruby-changes:53582] shyouhei:r65798 (trunk): array.c: avoid (VALUE)--
shyouhei 2018-11-19 15:48:09 +0900 (Mon, 19 Nov 2018) New Revision: 65798 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65798 Log: array.c: avoid (VALUE)-- This args[1]-- overflows when it is zero. Should do that only when we can say it is nonzero. Modified files: trunk/array.c Index: array.c =================================================================== --- array.c (revision 65797) +++ array.c (revision 65798) @@ -3598,7 +3598,8 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/array.c#L3598 take_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, cbarg)) { VALUE *args = (VALUE *)cbarg; - if (args[1]-- == 0) rb_iter_break(); + if (args[1] == 0) rb_iter_break(); + else args[1]--; if (argc > 1) val = rb_ary_new4(argc, argv); rb_ary_push(args[0], val); return Qnil; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/