aboutsummaryrefslogtreecommitdiffstats
path: root/enum.c
Commit message (Collapse)AuthorAgeFilesLines
...
* * enum.c (nmin_filter): Fix limit value.akr2015-10-041-3/+3
| | | | | | | | | patch by Helder Pereira. [Bug #11471] [ruby-core:70477] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* preserve encodings in error messagesnobu2015-09-281-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c: added doc for Enumerable#ziphsbt2015-08-111-0/+4
| | | | | | | | [fix GH-985] Patch by @yui-knk * test/ruby/test_enum.rb: added tests for Enumerable#zip [fix GH-985] Patch @yui-knk git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * Add test case for empty array and first method with args.hsbt2015-07-041-0/+1
| | | | | | Patch by @yui-knk [fix GH-955] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c: remove volatile, use RB_GC_GUARDnormal2015-07-041-6/+12
| | | | | | | | | | | volatile appears unnecessary in most cases as the VALUEs are used as arguments of uninlined functions. Even worse, volatile can be insufficient in places where RB_GC_GUARD is necessary. * enum.c (zip_ary): remove volatile, use RB_GC_GUARD (zip_i): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * Add test for Enumerable#none? [fix GH-950] Patch by @yui-knkhsbt2015-07-011-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c (enum_minmax): simplify return value creationnormal2015-06-251-4/+2
| | | | | | | | | | | | | | No need to call three functions on success when one will do. This results in less LoC and smaller object code, too: text data bss dec hex filename 33860 0 296 34156 856c gcc/enum.o-before 33852 0 296 34148 8564 gcc/enum.o * enum.c (enum_minmax): simplify return value creation * test/ruby/test_enum.rb: test behavior on empty git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_chunk_while): New method Enumerable#chunk_while.akr2015-06-141-0/+71
| | | | | | | | [ruby-core:67738] [Feature #10769] proposed by Tsuyoshi Sawada. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c: [DOC] Fix typo [ci skip][Fix GH-904]gogotanaka2015-06-011-1/+1
| | | | | | Patch provided by @jwworth git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c: fix a sample code. Patch by @eagletmthsbt2015-05-161-1/+1
| | | | | | [fix GH-901][ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_grep_v, grep_i, grep_iter_i, Init_enum):sorah2015-05-141-3/+30
| | | | | | Implement Enumerable#grep_v. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_to_a): revert r50457.glass2015-05-131-8/+1
| | | | | | | | it requires recursion check. then, it doesn't make performance improvement. [Bug #11130] [Feature #9118] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_to_a): fix incompatibility introduced in r50457.glass2015-05-121-3/+3
| | | | | | | | [Bug #11130] * test/ruby/test_enum.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_to_a): Use size to set array capa when possible.glass2015-05-101-1/+8
| | | | | | | the patch is from HonoreDB <aweiner at mdsol.com>. [fix GH-444] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert "temp".glass2015-05-101-11/+0
| | | | | | It's my fault. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert "capa"glass2015-05-101-1/+1
| | | | | | | | It's my fault. This reverts commit 5e17fc6bc7cb8b0e58b05fa9ebf2c47ec73ecbb3. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert "temp"glass2015-05-101-0/+4
| | | | | | This reverts commit 3482910fc4ca8515b38f56bdd9fa0db7002413ad. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* capaglass2015-05-101-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* tempglass2015-05-101-1/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c: Enumerable#chunk and Enumerable#slice_before no longer takesakr2015-04-061-33/+6
| | | | | | | | the initial_state argument. [Feature #10958] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_sort_by): add WBs.ko12015-03-181-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c: [DOC] Fixes Enumerable#member? documentationgogotanaka2015-03-141-0/+2
| | | | | | [fix GH-756][ci skip] Patch by @shamanime git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: use T_IMEMO to represent `struct MEMO' value.ko12015-03-111-59/+58
| | | | | | | | | | | | | | | | | | | | | | memo->v1 and memo->v2 is WB protected values. So use MEMO_V1/V2_SET() macros to set these values. memo->u3 is ambiguous (sometimes a VALUE, sometimes an integer value), so use gc_mark_maybe() in gc.c to mark it. Rename NEW_MEMO() to MEMO_NEW(). Move MEMO_FOR and NEW_MEMO_FOF macros from node.h. Export a rb_imemo_new() function for ext/ripper. * node.h: remove NODE_MEMO. * enum.c: catch up these change. * enumerator.c: ditto. * load.c: ditto. * ext/objspace/objspace.c (count_nodes): ditto. * gc.c (gc_mark_children): mark imemo_memo type. * parse.y (new_args_gen): use T_IMEMO. (I'm not sure it is working correctly...) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: define struct MEMO.ko12015-03-111-152/+152
| | | | | | | | | | | * enum.c: use MEMO. * enumerator.c: ditto. * load.c: ditto. * node.h: return (struct MEMO *) pointer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_slice_when): [DOC] fix typo.ktsj2015-03-101-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c: Fix typo in slice_after's exception message.hsbt2015-03-041-1/+1
| | | | | | [fix GH-842][ci skip] Patch by @jsyeo git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c: Fixnum onlynobu2015-02-281-5/+5
| | | | | | | * enum.c (limit_by_enum_size, enum_size_over_p): check only against Fixnum size. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c: limit sizenobu2015-02-281-0/+20
| | | | | | | | * enum.c (enum_each_slice, enum_each_cons): limit elements size by the enumerator size. suggested by Hans Mackowiak <hanmac AT gmx.de> at [ruby-core:68335] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use rb_funcallvnobu2015-02-161-2/+2
| | | | | | | * use rb_funcallv() for no arguments call instead of variadic rb_funcall(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* [DOC]akr2014-12-121-1/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: Gather declarations in non-header files.akr2014-11-181-2/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: Include ruby.h and ruby/encoding.h to beakr2014-11-151-2/+1
| | | | | | | | includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c: nil if no iterationnobu2014-10-151-0/+1
| | | | | | | * enum.c (enum_inject): return nil if no iteration, instead of Qundef. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c: use Qundefnobu2014-10-151-8/+7
| | | | | | * enum.c (enum_inject): use Qundef for no initial values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c: min(n) drops elements bigger than the n-th maximum element.akr2014-10-141-1/+18
| | | | | | | | | | (struct nmin_data): New field to record the n-th maximumelement, limit (nmin_filter): Update limit field. (nmin_i): Drop too big eleents. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update doc.akr2014-10-131-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (nmin_run): max(n) and max_by(n) returns an array inakr2014-10-131-0/+3
| | | | | | | | | descending order. [ruby-core:65452] Suggested by David Grayson. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Update doc. and warnings.akr2014-10-101-28/+29
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_chunk): Deprecate the state management.akr2014-09-201-4/+10
| | | | | | | | (enum_slice_before): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_slice_when): New method: Enumerable#slice_when.akr2014-09-201-0/+133
| | | | | | | | | | | | | | (slicewhen_i): New function. (slicewhen_ii): New function. * enumerator.c (InitVM_Enumerator): New method: Enumerator::Lazy#slice_when. [ruby-core:62499] [Feature #9826] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Move enum.one? documentation before the relevant method.knu2014-08-061-18/+17
| | | | | | | | * enum.c (enum_one): Move enum.one? documentation before the relevant method. Submitted by @vipulnsward. [Fixes GH-687] https://github.com/ruby/ruby/pull/687 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* symbols instead of IDsnobu2014-07-281-2/+2
| | | | | | | | | | | | | | | | | * encoding.c (rb_enc_get_index): deal with symbols instead of IDs to get rid of inadvertent pin-downs. * enum.c (chunk_ii): ditto. * enumerator.c (append_method): ditto. * iseq.c (iseq_load): ditto. * marshal.c (w_symbol, r_symlink, r_symreal, r_symbol): ditto. * signal.c (trap_handler): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* revert r46859 and r46860nobu2014-07-181-34/+1
| | | | | | revert "enum.c: optimize any? object allocations for Array and Hash" git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c: optimize any? object allocations for Array and Hashnobu2014-07-181-1/+34
| | | | | | | | * enum.c (enum_any): optimize object allocations for Array and Hash when `each` is not redefined, always false if empty and the case without a block. [fix GH-617] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c: [DOC] Use #find in example to clarify alias by @rachellogiezzak2014-05-251-2/+2
| | | | | | | Patch submitted via documenting-ruby/ruby#34 [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c: suppress warningsnobu2014-05-181-1/+1
| | | | | | * enum.c (sliceafter_ii): suppress unused-value warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c: Enumerable#slice_after implemented.akr2014-05-181-0/+125
| | | | | | | | | | * enumerator.c: Enumerator::Lazy#slice_after implemented. Requested by Tsuyoshi Sawada. [ruby-core:58123] [Feature #9071] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* [DOC]akr2014-05-051-0/+45
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c: fix condition to recycle block argumentnobu2014-04-161-1/+1
| | | | | | | | * enum.c (dont_recycle_block_arg): fix condition to recycle block argument. lambda with rest can get internal array directly. [ruby-core:62060] [Bug #9749] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c: make each_slice and each_cons more efficientnobu2014-04-151-4/+20
| | | | | | | | * enum.c (enum_each_slice, enum_each_cons): make more efficient by allocating less and recycling block argument arrays if possible. [Fixes GH-596] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e