aboutsummaryrefslogtreecommitdiffstats
path: root/array.c
Commit message (Collapse)AuthorAgeFilesLines
* * array.c (rb_ary_take_while, rb_ary_drop_while): removed unusednobu2008-04-151-2/+0
| | | | | | | variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (ary_new): new integer overflow check condition.matz2008-04-141-2/+2
| | | | | | | | | suggested by TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com> in [ruby-dev:34156]. * array.c (rb_ary_initialize): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_cycle): Make Enumerable#cycle do a finite loop whenknu2008-04-131-9/+25
| | | | | | | | | the number of cycles is specified. * array.c (rb_ary_cycle): Ditto for Array#cycle. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_find_index): Add support for find_index(obj);knu2008-04-111-0/+3
| | | | | | | | | [ruby-dev:34313]. * array.c (rb_ary_index): Define find_index as an alias to index. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix mistake in the previous commit.knu2008-04-101-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_pop_m, rb_ary_shift_m): Update documents forknu2008-04-101-9/+11
| | | | | | | | | | #pop() and #shift(). * array.c (rb_ary_slice_bang): Update document. Assigning array[*args]= nil no longer removes elements. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (ary_new): fix size check. [ruby-dev:34123]mame2008-03-251-3/+11
| | | | | | | | | | | | * array.c (rb_ary_take, rb_ary_drop): check negative size and use NUM2LONG instead of FIX2LONG. [ruby-dev:34123] * enum.c (enum_take, enum_drop): check negative size. * test/ruby/test_array.rb: add tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_take, rb_ary_take_while, rb_ary_drop,mame2008-03-171-0/+95
| | | | | | | | | rb_ary_drop_while): new method. [ruby-dev:34067] * test/ruby/test_array.rb: add tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_slice_bang): should not use rb_ary_subseq()matz2008-03-131-1/+2
| | | | | | | which shares internal pointer. splice modifies the receiver right after subseq. [ruby-dev:34005] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_combination): argument check before creatingmatz2008-03-111-2/+2
| | | | | | | | Enumerator. * array.c (rb_ary_permutation): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix doc.akr2008-03-091-5/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix rdoc.akr2008-03-071-2/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (fix_to_s): avoid rb_scan_args() when no argumentmatz2008-03-051-16/+16
| | | | | | | | | | | | | | | | | | | | | | given. * bignum.c (rb_big_to_s): ditto. * enum.c (enum_first): ditto. * eval_jump.c (rb_f_catch): ditto. * io.c (rb_obj_display): ditto. * class.c (rb_obj_singleton_methods): ditto. * object.c (rb_class_initialize): ditto. * random.c (rb_f_srand): ditto. * range.c (range_step): ditto. * re.c (rb_reg_s_last_match): ditto. * string.c (rb_str_to_i): ditto. * string.c (rb_str_each_line): ditto. * string.c (rb_str_chomp_bang): ditto. * string.c (rb_str_sum): ditto. * string.c (str_modifiable): declare inline. * string.c (str_independent): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (combi_len, rb_ary_product): check for overflow.nobu2008-02-261-2/+10
| | | | | | | [ruby-Bugs-18355] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (recursive_cmp): compare minimal length parts.nobu2008-02-261-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_eql, rb_ary_cmp): get rid of stack overflow withnobu2008-02-261-19/+39
| | | | | | | self-recursive constructs. [ruby-Bugs-18356] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_unshift_m): expands enough for argc. [ruby-dev:33880]nobu2008-02-211-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_usascii_new{,2}: defined.naruse2008-01-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (rb_str_new): set US-ASCII and ENC_CODERANGE_7BIT when empty string. * encoding.c (rb_usascii_encoding, rb_usascii_encindex): defined. (rb_enc_inspect, enc_name, rb_locale_charmap, rb_enc_name_list_i): use rb_str_ascii_new. * array.c (recursive_join, inspect_ary): ditto. * object.c (nil_to_s, nil_inspect, true_to_s, false_to_s, rb_mod_to_s): ditto. * hash.c (inspect_hash, rb_hash_inspect, rb_f_getenv, env_fetch, env_clear, env_to_s, env_inspect): ditto. * numeric.c (flo_to_s, int_chr, rb_fix2str): ditto. * bignum.c (rb_big2str): ditto. * file.c (rb_file_ftype, rb_file_s_dirname, rb_file_s_extname, file_inspect_join, Init_file): ditto. * test/ruby/test_ruby_m17n.rb: add checks for encoding of string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (sort_1): remove ary_sort_check(). in-place sort keepmatz2008-01-241-43/+12
| | | | | | | | original elements even when it's modified. * array.c (sort_2): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (collect_bang_i): use rb_ary_store() to avoid potentialmatz2008-01-241-129/+50
| | | | | | | | | memory corruption. a patch from Yusuke Endoh <mame@tsg.ne.jp> in [ruby-dev:33328]. * array.c (ITERATE): remove unnecessary macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h (rb_str_tmp_new, rb_str_shared_replace):nobu2008-01-161-1/+0
| | | | | | | prototype moved. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_zip): honor length of the receiver, not thematz2008-01-081-0/+79
| | | | | | | | | | | | | shortest length. [ruby-core:14738] * enum.c (enum_zip): returns array not enumerator for no block form. [ruby-core:14738] * enumerator.c (next_ii): do not ignore multiple values yielded. * array.c (rb_ary_zip): faster version without creating generators. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * $Date$ keyword removed to avoid inclusion of locale dependentakr2008-01-061-1/+0
| | | | | | | string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix typos.akr2007-12-311-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (tmpbuf): use rb_str_tmp_new().nobu2007-12-261-8/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h, random.c, array.c:akr2007-12-241-2/+2
| | | | | | | | | | change exported name. genrand_int32 -> rb_genrand_int32. genrand_real -> rb_genrand_real. [ruby-core:14335] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_at): updated documentation. a patch from Tadashimatz2007-12-231-2/+0
| | | | | | Saito <shiba AT mail2.accsnet.ne.jp> in [ruby-core:14330]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation): add volatile to avoid GC problem.ko12007-12-221-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_slice_bang): If an invalid range is given, doknu2007-12-101-2/+12
| | | | | | | not raise an exception but return nil just like slice() does. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_slice_bang): should return nil if position outmatz2007-12-101-0/+1
| | | | | | | of range. a patch from Akinori MUSHA <knu AT iDaemons.org>. [ruby-dev:32518] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (flatten): some performance improvements, based on a patchnobu2007-12-071-48/+59
| | | | | | | | from Yusuke ENDOH <mame AT tsg.ne.jp> in [ruby-core:13877]. [ruby-core:13851] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * insns.def (concatarray, splatarray): use to_a instead ofmatz2007-12-011-1/+0
| | | | | | | | to_splat. * insnhelper.ci (caller_setup_args): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation): add gc guard codes.ko12007-11-211-2/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation): gives all permutations of elementsmatz2007-11-191-5/+11
| | | | | | | if no argument given. a patch from Yusuke ENDOH <mame AT tsg.ne.jp>. [ruby-dev:32309] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_product): core dumped with non array arguments.matz2007-11-061-1/+1
| | | | | | a patch from Yusuke ENDOH <mame AT tsg.ne.jp>. [ruby-dev:32180] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_each_index): should return meaningful value.matz2007-11-061-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c: raise IndexError for negative length in rb_ary_filldavidflanagan2007-10-261-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_assoc): check and convert inner arrays (assocs)matz2007-10-251-3/+2
| | | | | | using #to_ary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * range.c (range_first): takes first n element if argument ismatz2007-10-181-2/+2
| | | | | | | | | | | given. [ruby-core:12697] * range.c (range_last): returns last n elements if argument is given. * array.c (rb_ary_subseq, rb_ary_last): export. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_combination): fixed memory corruption due to toomatz2007-10-121-2/+2
| | | | | | | | | small memory allocation * array.c (rb_ary_product): accessing out of memory bounds. condition fixed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation): use frozen shared hidden array.nobu2007-10-091-4/+3
| | | | | | | [ruby-dev:31985] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation, rb_ary_combination): missing typenobu2007-10-091-19/+19
| | | | | | | | | names. * array.c (rb_ary_permutation): used buffer should be t1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: remove to_a completely.matz2007-10-091-19/+17
| | | | | | * array.c (tmpbuf): keep DRY to clear klass of temporary objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation, rb_ary_combination, rb_ary_product):nobu2007-10-091-1/+11
| | | | | | | hide internal buffer objects. [ruby-dev:31982] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation, rb_ary_product): support non C99usa2007-10-041-3/+4
| | | | | | | compilers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation): remove C99 dependency.matz2007-10-041-5/+8
| | | | | | | | [ruby-dev:31934] * array.c (rb_ary_product): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_product): generalized product, now takesmatz2007-10-021-14/+58
| | | | | | | arbitrary number of arrays. a patch from David Flanagan <david AT davidflanagan.com>. [ruby-core:12346] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation): small dirty hack by Matz to avoidmatz2007-10-011-2/+5
| | | | | | arrays on stack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation): implementation contributed frommatz2007-10-011-24/+88
| | | | | | | | | David Flanagan. [ruby-core:12344] * array.c (rb_ary_combination): RDoc update to clarify. a patch from David Flanagan. [ruby-core:12344] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_combination): revisit #combination behavior.matz2007-10-011-5/+3
| | | | | | suggested by David Flanagan. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e