summaryrefslogtreecommitdiff
path: root/array.c
AgeCommit message (Collapse)Author
2015-11-17update rdoc of dig methods [ci skip]nobu
* array.c (rb_ary_dig), hash.c (rb_hash_dig): [DOC] Update comments describing dig methods. [Fix GH-1103] * struct.c (rb_struct_dig): [DOC] add rdoc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-09dignobu
* array.c (rb_ary_dig): new method Array#dig. * hash.c (rb_hash_dig): new method Hash#dig. * object.c (rb_obj_dig): dig in nested arrays/hashes. [Feature #11643] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-06* array.c: clarifies Array#reject! documentation.gogotanaka
[fix GH-894][ci skip] Patch by @GxSplinter git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-29RUBY_DTRACE_CREATE_HOOKnobu
* internal.h (RUBY_DTRACE_CREATE_HOOK): macro to call hook at object creation. * vm.c (rb_source_location, rb_source_loc): retrieve source path and line number at once. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-22adjust spaces [ci skip]nobu
* array.c (rb_ary_collect): [DOC] Fix space of code example of Array#map. [Fix GH-1062] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-28preserve encodings in error messagesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-15array.c: [DOC] correct Array#sort rdoc [ci skip]nobu
* array.c (rb_ary_sort_bang, rb_ary_sort): [DOC] correct block return values, which may be a negative or positive integer, not ony -1 or +1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-15array.c: [DOC] correct Array#sort rdoc [ci skip]nobu
* array.c (rb_ary_sort_bang, rb_ary_sort): [DOC] Correct description of array sort block return values. And also fix up the grammar a bit. [Fix GH-1020] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-11array.c: fix buffer sizenobu
* array.c (rb_ary_repeated_permutation): fix buffer size, ALLOCV_N already multiplies element size. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-13remove needless volatilenobu
* array.c (rb_ary_each): remove needless volatile for outdated clang 3.0. revert r32201. * cont.c (cont_capture): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-05array.c: fix memory leaknobu
* array.c (rb_ary_sort_bang): the original array may not be embedded even if a substitution array is embedded, as it is embedded when the original array is short enough but not embedded. [ruby-dev:49166] [Bug #11332] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-21array.c: use ALLOCV_Nnobu
* array.c (rb_ary_permutation): use ALLOCV_N instead of ALLOCV. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-12array.c: fix for enumeratornobu
* array.c (rb_ary_bsearch_index): fix function typt to return enumerator if no block given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-12array.c: typonobu
* array.c (rb_ary_bsearch_index): fix typo. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-12array.c: bsearch_indexnobu
* array.c (rb_ary_bsearch_index): Implement Array#bsearch_index method, which is similar to bsearch and returns the index or nil. [Feature #10730] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-11array.c: fix array size overflownobu
* array.c (ary_ensure_room_for_push): check if array size will exceed maxmum size to get rid of buffer overflow. [ruby-dev:49043] [Bug #11235] * array.c (ary_ensure_room_for_unshift, rb_ary_splice): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-04* array.c: Revert r50763. because "reentered" is not typo.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-04* array.c: fix a typo. Patch by @manish-shrivastavahsbt
[fix GH-922] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-15array.c: [DOC] return values are not new array [CI SKIP]nobu
* array.c (rb_ary_assoc, rb_ary_rassoc): [DOC] the result when key was found is the existing element, not a new array. reported by Giau Nguyen <giaunv AT nustechnology.com>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-07* array.c: document that first element is kept when usinghsbt
Array#uniq and #uniq! [fix GH-845][ci skip] Patch by @riffraff git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-25array.c: reduce to_ary callnobu
* array.c (flatten): no need to call to_ary method on elements beyond the given level. [ruby-core:67637] [Bug #10748] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-15array.c: linear performancenobu
* array.c (rb_ary_select_bang, ary_reject_bang): linear performance. [ruby-core:67418] [Feature #10714] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-12* array.c (rb_ary_each): documented return value.hsbt
[misc #10469][ruby-core:66063] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-12array.c: trivial optimizationsnobu
* array.c (rb_ary_bsearch): trivial optimizations, for Fixnum, and by keeping the last satisfied element. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-11array.c: class name encodingnobu
* array.c (rb_ary_bsearch): preserve encoding of class name in an exception message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-10array.c: keep consistencynobu
* array.c (rb_ary_select_bang): keep the array consistent by removing unselected values soon. [ruby-dev:48805] [Bug #10722] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-04* array.c: improve docs for Array#reject. [ruby-core:65324][misc #10307]ayumin
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-03* array.c: Improve performance of Array#shift. use shared instead ofhsbt
MEMMOVE if with arguments. Patch by @ksss [fix GH-537] * test/ruby/test_array.rb: ditto. * benchmark/bm_array_shift.rb: Added benchmark of GH-537 issue. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-02array.c: decorationnobu
* array.c (rb_ary_plus): inline decoration of the operator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-02array.c (rb_ary_plus): in documentation, added note aboutduerst
inefficiency of repeated += operations. [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15* internal.h: Include ruby.h and ruby/encoding.h to beakr
includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-12array.c: swap volatile for RB_GC_GUARDnormal
* array.c (ary_recycle_hash): add RB_GC_GUARD (rb_ary_diff): remove volatile [Bug #10369] The RB_GC_GUARD seems needed for most of the ary_recycle_hash functions anyways. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-09internal.h: optimize rb_ary_new_from_argsnobu
* internal.h (rb_ary_new_from_args): optimization by expanding arguments in caller to get rid of va_list if possible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-09array.c: fix potential memory leaknobu
* array.c (ary_new): allocate buffer in heap after new object get allocated successfully, to get rid of potential memory leak at object allocation failure. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-22array.c: GC guardnobu
* array.c (rb_ary_splice): prevent replacing array from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-21* array.c: use rb_equal_opt() for performance improvement.glass
[ruby-core:64954] [Feature #10227] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-08* gc.c: add incremental GC algorithm. [Feature #10137]ko1
Please refer this ticket for details. This change also introduces the following changes. * Remove RGENGC_AGE2_PROMOTION and introduce object age (0 to 3). Age can be count with FL_PROMOTE0 and FL_PROMOTE1 flags in RBasic::flags (2 bit). Age == 3 objects become old objects. * WB_PROTECTED flag in RBasic to WB_UNPROTECTED bitmap. * LONG_LIVED bitmap to represent living objects while minor GCs It specifies (1) Old objects and (2) remembered shady objects. * Introduce rb_objspace_t::marked_objects which counts marked objects in current marking phase. marking count is needed to introduce incremental marking. * rename mark related function and sweep related function to gc_(marks|sweep)_(start|finish|step|rest|continue). * rename rgengc_report() to gc_report(). * Add obj_info() function to get cstr of object details. * Add MEASURE_LINE() macro to measure execution time of specific line. * and many small fixes. * include/ruby/ruby.h: add flag USE_RINCGC. Now USE_RINCGC can be set only with USE_RGENGC. * include/ruby/ruby.h: introduce FL_PROMOTED0 and add FL_PROMOTED1 to count object age. * include/ruby/ruby.h: rewrite write barriers for incremental marking. * debug.c: catch up flag name changes. * internal.h: add rb_gc_writebarrier_remember() instead of rb_gc_writebarrier_remember_promoted(). * array.c (ary_memcpy0): use rb_gc_writebarrier_remember(). * array.c (rb_ary_modify): ditto. * hash.c (rb_hash_keys): ditto. * hash.c (rb_hash_values): ditto. * object.c (init_copy): use rb_copy_wb_protected_attribute() because FL_WB_PROTECTED is moved from RBasic::flags. * test/objspace/test_objspace.rb: catch up ObjectSpace.dump() changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-15* array.c (rb_ary_tmp_new): added.ko1
This function creates internal use only array (which is completely hided by ObjectSpace.each_object) with filling nil. Otherwise, it can be incldues strange VALUEs. * internal.h: added. * node.h: use rb_ary_tmp_new_fill() for MEMO. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-18array.c: array may be modified in the blocknobu
* array.c (rb_ary_any_p): the array may be modified in the yielded block, do not access directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-18optimized any? methodsnobu
* array.c (rb_ary_any_p), hash.c (rb_hash_any_p): optimized versions. these are bit faster than optimization in Enumerable#any?. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-11* array.c: Clarify documentation for Array#insert.hsbt
[ruby-core:62934] [Bug #9901] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-18constify parametersnobu
* include/ruby/intern.h: constify `argv` parameters. * include/ruby/ruby.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-14array.c: non-recursive rcombinate0nobu
* array.c (rcombinate0): remove recursion, by looping with indexes stored in `p`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-14array.c: non-recursive rpermute0nobu
* array.c (rpermute0): remove recursion, by looping with indexes stored in `p`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-14array.c: non-recursive permute0nobu
* array.c (permute0): remove recursion, by looping with indexes stored in `p`. [ruby-core:63103] [Bug #9932] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-14array.c: combinate0nobu
* array.c (combinate0): extract. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-13array.c: combination on a shared copynobu
* array.c (rb_ary_combination): iterate on a shared copy, and use array of indexes instead of array of chosen objects. [ruby-core:63149] [Bug #9939] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-13array.c: yield_indexed_valuesnobu
* array.c (yield_indexed_values): extract from permute0(), rpermute0(), and rcombinate0(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-13array.c: fix array sizenobu
* array.c (rb_ary_permutation): `p` is the array of size `r`, as commented at permute0(). since `n >= r` here, buffer overflow never happened, just reduce unnecessary allocation though. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-24* array.c: [DOC] Clarify default argument for Array.new.zzak
By @Elffers [Fixes GH-610] [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e