aboutsummaryrefslogtreecommitdiffstats
path: root/array.c
Commit message (Collapse)AuthorAgeFilesLines
...
* * array.c (rb_ary_clear): should not unshare embedded array, andnobu2010-07-191-1/+4
| | | | | | should make unshared array embedded. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_clear): no need to duplicate buffer just beforenobu2010-07-181-2/+5
| | | | | | clearing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_product): clear uninitialized elements in temporaryakr2010-06-061-0/+1
| | | | | | | | array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_product): need to set the length in order to getnobu2010-06-061-0/+1
| | | | | | | the entries marked. [ruby-dev:41540] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * removed trailing spaces.nobu2010-05-291-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_product): Use tmpary instead, to ensure markingshyouhei2010-05-281-3/+3
| | | | | | | arrays by GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_product): Do not rely on GC, t0 should beshyouhei2010-05-281-1/+5
| | | | | | | checked explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: Documentation: change => in call-seq to ->.marcandre2010-05-171-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Harmonize "#=>" in examples. [ruby-core:30206] * bignum.c: ditto * class.c: ditto * compar.c: ditto * cont.c: ditto * dir.c: ditto * encoding.c: ditto * enum.c: ditto * enumerator.c: ditto * error.c: ditto * eval.c: ditto * file.c: ditto * gc.c: ditto * io.c: ditto * load.c: ditto * marshal.c: ditto * math.c: ditto * numeric.c: ditto * object.c: ditto * pack.c: ditto * proc.c: ditto * process.c: ditto * random.c: ditto * range.c: ditto * re.c: ditto * ruby.c: ditto * signal.c: ditto * sprintf.c: ditto * string.c: ditto * struct.c: ditto * thread.c: ditto * time.c: ditto * transcode.c: ditto * variable.c: ditto * vm_eval.c: ditto * vm_method.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: Harmonize documentation, in particular regarding:marcandre2010-05-131-201/+265
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - methods returning enumerators - array methods and argument naming (array -> ary, an_array -> new_ary) - minor improvements, typo fixed and styling issues Other documentation errors fixed: - return value was self instead of a new array (or vice-versa) for Array#{pop,shift,permutation,repeated_permutation,keep_if} - Array#rindex was missing the form with a block. * dir.c: ditto. * enum.c: ditto. Modified Enumerable#reverse_each' documentation to clarify that #each will be finish before any element is yielded. * error.c: ditto. * gc.c: ditto. * hash.c: ditto. * io.c: ditto. IO#{codepoints,each_codepoint} fixed as per [ruby-core:23948] * numeric.c: ditto. * range.c: ditto. * string.c: ditto. * struct.c: ditto. * vm_eval.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_fetch, rb_ary_splice, rb_ary_store): Improve IndexErrormarcandre2010-05-081-5/+6
| | | | | | | | messages [ruby-core:28394] * hash.c (rb_hash_fetch_m): Improve KeyError message git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_repeated_permutation): new method added. a patchmatz2010-04-161-0/+182
| | | | | | | | from Makoto Kishimoto in [ruby-core:29267] [ruby-core:28724] * array.c (rb_ary_repeated_combination): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation): Remove limitation for lengthy permutationsmarcandre2010-04-071-23/+4
| | | | | | | | [ruby-core:29240] * test/ruby/test_array.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_product): Don't limit based on size when a block is givenmarcandre2010-04-031-15/+22
| | | | | | | | cf [ruby-core:29240] * test/ruby/test_array.rb (class): Test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_product): Make defensive copy in case of block...marcandre2010-04-021-1/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_product): Test for reentrymarcandre2010-04-021-0/+3
| | | | | | * test/ruby/test_array.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_product): Accept a block [ruby-core:29045]marcandre2010-04-021-8/+19
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_uniq_bang): the array is already unique if theakr2010-03-201-0/+4
| | | | | | | | length is zero or one. (rb_ary_uniq): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_join): remove Enumerable#join. [ruby-core:24786]matz2010-03-131-1/+1
| | | | | | * array.c (ary_join_1): use #to_ary to detect recursive array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_select_bang): select! removes all elements formatz2010-03-031-0/+53
| | | | | | | | which block returns false. [ruby-core:27286] * array.c (rb_ary_keep_if): #keep_if, new method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_push_m): use rb_ary_modify instead ofnaruse2010-02-151-1/+1
| | | | | | rb_ary_modify_check. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_delete): RDoc update. a patch from Hugh Sasse.matz2010-02-131-3/+6
| | | | | | | | [ruby-core:28128] * array.c (rb_ary_compact_bang): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_push_m, rb_ary_unshift_m, rb_ary_aset),nobu2010-02-101-5/+19
| | | | | | | | | | | | | | (rb_ary_insert, rb_ary_replace, rb_ary_concat), (rb_ary_uniq_bang, rb_ary_flatten_bang): check if frozen after wrong number of arguments but before TypeError. [ruby-core:28140] * hash.c (rb_hash_replace): ditto. * string.c (rb_str_replace): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_rotate): new methods, Array#rotate! andnobu2010-01-211-7/+110
| | | | | | | Array#rotate. [ruby-dev:17194] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_reverse_m): copy directly.nobu2010-01-211-4/+18
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_to_ary): do not use #respond_to? to detectmatz2009-10-291-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to_ary. Just call. [ruby-core:23738] * eval.c (rb_check_funcall): new function with method existence check. returns Qundef when the method does not exist. * enumerator.c (enumerator_rewind): just call method, using rb_check_funcall(). [ruby-core:23738] * error.c (exc_equal): ditto. * object.c (convert_type): ditto. * error.c (rb_name_err_mesg_new): export function. * eval.c (make_exception): ditto. * io.c (pop_last_hash): return early when the last argument is nil. * io.c (rb_io_puts): treat T_STRING specially for small optimization. * vm_eval.c (raise_method_missing): skip method call if possible using rb_method_basic_definition_p(). * vm_eval.c (method_missing): ditto. * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_debug): test suites changed to ignore exceptions caused by just-call policy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c: rdoc for <=>, casecmpmarcandre2009-10-281-1/+1
| | | | | | | | | | | | * bignum.c: rdoc for <=> * file.c: ditto * time.c: ditto * compar.c: rdoc git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_cmp): Array#<=> returns nil when comparison failsmarcandre2009-10-261-2/+3
| | | | | | [ruby-core:26316] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_{times, shuffle_bang, sample}): reducing macromatz2009-10-051-11/+20
| | | | | | | | | | | | | calls inside of the loop by keeping pointers in local variables. a patch from Masahiro Kanai (CanI) in [ruby-dev:39406]. It was found and fixed at Security and Programming camp 2009. * string.c (rb_str_{times, split_m}): ditto. * struct.c (rb_struct_{getmember, set, aref_id, aset_id}, {make, inspect}_struct, recursive_{equal, hash, eql}): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (ary_make_shared): should count frozen array itself.nobu2009-10-021-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_exec_recursive_outer, rb_exec_recursive): Added method to ↵marcandre2009-09-151-6/+8
| | | | | | | | | | | | | | | | | | short-circuit to the outermost level in case of recursion * test/ruby/test_thread.rb (test_recursive_outer): Test for above * hash.c (rb_hash_hash): Return a sensible hash for in case of recursion [ruby-core:24648] * range.c (rb_range_hash): ditto * struct.c (rb_struct_hash): ditto * array.c (rb_array_hash): ditto * test/ruby/test_array.rb (test_hash2): test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/st.h (st_hash_func): use st_index_t.nobu2009-09-081-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (permute0): use chars for boolean array.nobu2009-08-031-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_{permutation,combination}): disallow reentrancenobu2009-08-031-8/+16
| | | | | | | with continuation since work-buffers cannot restore. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_{permutation,combination,product}): must not usenobu2009-08-031-5/+5
| | | | | | | ary_discard on strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_combination, rb_ary_product): prevent from GC.nobu2009-08-021-2/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: suppressed shorten-64-to-32 warnings.nobu2009-07-181-8/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (recursive_hash): reject recursive key.akr2009-07-171-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (recursive_join): raise ArgumentError for joiningmatz2009-07-171-3/+2
| | | | | | | | | | | recursive array. * array.c (ary_join_1): ditto. * test/ruby/test_array.rb (TestArray#test_join2): test updated for recursive join. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_sample): RDoc update. a patch from Florianmatz2009-07-161-3/+5
| | | | | | Frank. [ruby-core:24347] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (ary_join_1): should recurse for element array.nobu2009-07-101-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (recursive_join): use obj to tell if recursion occurs.nobu2009-07-101-5/+6
| | | | | | | | | [ruby-core:24150] * enum.c (enum_join): reverted r23966. [ruby-core:24196] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_join): add Enumerable#join.matz2009-07-031-32/+91
| | | | | | | | | * array.c (ary_join_1): recursive join for Enumerators (and objects with #to_a). * array.c (rb_ary_join): performance tune. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_memsize): added.ko12009-06-161-0/+11
| | | | | | | | | | | | * io.c (rb_io_memsize): added. * regcomp.c (onig_memsize): added. * string.c (rb_str_memsize): added. * transcode.c (rb_transcoding_memsize, rb_econv_memsize): added. * variable.c (rb_geneic_ivar_memsize): added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_exec_recursive_paired): new function for propernobu2009-05-241-6/+6
| | | | | | | | | | | handling of recursive arrays. [EXPERIMENTAL] [ruby-core:23402] * array.c (rb_ary_equal, rb_ary_eql, rb_ary_cmp): use above. * hash.c (hash_equal): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_slice_bang): avoid call of rb_scan_args() unlessmatz2009-05-211-3/+9
| | | | | | it's really necessary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_shift, rb_ary_shift_m): clears unused elements.nobu2009-05-151-0/+6
| | | | | | | [ruby-dev:38448] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rename argument name.akr2009-05-091-10/+10
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_flatten_bang): clears temporary array.nobu2009-05-081-2/+15
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_flatten_bang): returns nil if nothing changed.nobu2009-05-071-1/+1
| | | | | | | a patch from Marc-Andre Lafortune in [ruby-core:23382]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_sample): negative sample number is invalid.nobu2009-05-071-0/+1
| | | | | | | [ruby-core:23374] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e