matz
9d9986d25c
* enum.c (enum_join): add Enumerable#join.
...
* 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
2009-07-03 18:14:33 +00:00
ko1
3caa4ee5e5
* array.c (rb_ary_memsize): added.
...
* 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
2009-06-16 22:36:27 +00:00
nobu
02fb261ec1
* thread.c (rb_exec_recursive_paired): new function for proper
...
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
2009-05-24 13:48:23 +00:00
matz
58949cf8f3
* array.c (rb_ary_slice_bang): avoid call of rb_scan_args() unless
...
it's really necessary.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-21 22:35:43 +00:00
nobu
62e5fa1737
* array.c (rb_ary_shift, rb_ary_shift_m): clears unused elements.
...
[ruby-dev:38448]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-15 08:35:35 +00:00
akr
e9e7e62025
rename argument name.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-09 05:44:20 +00:00
nobu
0d9c4400fc
* array.c (rb_ary_flatten_bang): clears temporary array.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-08 01:07:03 +00:00
nobu
94ee3e7e02
* array.c (rb_ary_flatten_bang): returns nil if nothing changed.
...
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
2009-05-07 07:40:11 +00:00
nobu
9936642c40
* array.c (rb_ary_sample): negative sample number is invalid.
...
[ruby-core:23374]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-07 05:26:16 +00:00
nobu
e4d687f372
* array.c (Init_Array): made #to_s an alias to #inspect to reduce
...
the result of recursive array. a patch from ujihisa at
[ruby-dev:38362]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-02 00:19:41 +00:00
nobu
1f6f4e6b59
* array.c: fixed types.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-02 00:13:45 +00:00
matz
8e75f9705f
* array.c (rb_ary_push): bypass rb_ary_store().
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-20 22:09:30 +00:00
mame
bded3bb726
* array.c (rb_ary_flatten): flatten(0) works as Array#dup.
...
[ruby-core:23168]
* test/ruby/test_array.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-15 11:47:54 +00:00
nobu
d1abc53721
* array.c, bignum.c, dln.c, error.c, gc.c, io.c, marshal.c,
...
numeric.c, pack.c, strftime.c, string.c, thread.c, transcode.c,
transcode_data.h, util.c, variable.c, vm_dump.c,
include/ruby/encoding.h, missing/crypt.c, missing/vsnprintf.c:
suppress VC type warnings. [ruby-core:22726]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 09:16:15 +00:00
nobu
2e54fe9d4d
* array.c, bignum.c, gc.c, numeric.c, string.c, util.c, insns.def,
...
missing/crypt.c, missing/vsnprintf.c, : suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-10 05:43:14 +00:00
matz
60d2f945fb
* array.c (rb_ary_fill): doc for Array#fill misses indication
...
about negative value for the start argument. [ruby-core:22497]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-06 04:12:56 +00:00
knu
0d0d5e9f71
* array.c (rb_ary_index, rb_ary_rindex): Emit a warning that a
...
given block is unused when an argument is specified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-24 15:02:01 +00:00
knu
1a1990df71
* array.c (rb_ary_index, rb_ary_rindex): We know that argc is not
...
zero when we reach here.
* array.c (rb_ary_initialize, rb_ary_index): Shrink a double
space. (NFC)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-23 06:54:58 +00:00
nobu
12d2c8ba41
stripped trailing spaces.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
nobu
1128e61562
* array.c (rb_ary_resurrect), string.c (rb_str_resurrect): new
...
functions based on [ruby-dev:37983]
* insns.def (putstring, duparray): use rb_{ary,str}_resurrect().
* iseq.c (iseq_data_to_ary): needs to result TS_VALUE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-18 05:33:36 +00:00
mame
e722ad99d5
* string.c (rb_hash_uint32, rb_hash_uint, rb_hash_start, rb_hash_end),
...
include/ruby/intern.h: add Murmurhash API. [ruby-dev:37784]
* complex.c (nucomp_hash), array.c (rb_ary_hash), time.c (time_hash),
string.c (rb_str_hsah), object.c (rb_obj_hash), range.c
(range_hash), struct.c (rb_struct_hash), hash.c (rb_any_hash),
rational.c (nurat_hash): use Murmurhash. [ruby-dev:37784]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 19:55:34 +00:00
nobu
766df600db
* array.c (rb_ary_uniq_bang, rb_ary_uniq): unique by the result of
...
given block. [ruby-dev:37998]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 15:45:43 +00:00
nobu
e1646e639a
* array.c (ary_resize_capa): should not overwrite outside embedded
...
array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 15:39:46 +00:00
nobu
f23292afb4
* array.c (ary_make_shared): returns shared root array itself, and
...
frozen array can be shared.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-11 06:47:12 +00:00
nobu
a2c7fdc709
* array.c (rb_ary_uniq): gets rid of copying.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-05 03:24:20 +00:00
nobu
e3c8cdca44
* array.c (ary_add_hash): split from ary_make_hash().
...
* array.c (ary_recycle_hash): clears internally used hash. this
name came from [ruby-dev:37908].
* array.c (rb_ary_diff, rb_ary_and, rb_ary_or, rb_ary_uniq_bang):
recycle hashes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-05 03:01:55 +00:00
nobu
8b093ebc3c
* array.c (ary_make_hash): hide a Hash used internally.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-05 02:37:49 +00:00
kazu
2b692644d9
* NEWS: add Array#sort_by!.
...
* array.c (rb_ary_sort_by_bang): RDoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-03 07:36:55 +00:00
matz
092861f37d
* array.c (rb_ary_sort_by_bang): RDoc update. [ruby-core:21742]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-02 12:05:06 +00:00
matz
765a6be700
* array.c (rb_ary_sort_by_bang): new method. requested in
...
[ruby-core:21709]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-02 10:43:27 +00:00
nobu
c330fb421e
* array.c (rb_ary_aset): fixed arguments evaluation order.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-26 07:00:43 +00:00
matz
d47e8e81a0
* array.c (ary_double_capa): a new function to expand array more
...
aggressively. [ruby-core:21460]
* array.c (rb_ary_store): use ary_double_capa().
* array.c (rb_ary_unshift_m): ditto.
* array.c (rb_ary_splice): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-21 15:27:35 +00:00
usa
6ff613fc09
* array.c (take_items): to_ary() raises ArgumentError if cannot to
...
convert to Array. [ruby-dev:37797]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-21 05:43:04 +00:00
nobu
cab67c3197
* array.c (take_items), enum.c (enum_zip): tries to convert to
...
array first. [ruby-core:21442]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 21:47:48 +00:00
matz
8fb2235f48
* array.c (rb_ary_push_m): add modification check before actual
...
operation. [ruby-dev:37440]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-17 06:56:42 +00:00
matz
a89d928bfb
* array.c (rb_ary_pop_m): use enum ary_take_pos_flags.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-17 06:52:18 +00:00
matz
405b527276
* array.c (rb_ary_times): taint (and untrust) status should be
...
inherited by "ary * 0". [ruby-dev:37024]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-25 14:29:39 +00:00
yugui
16285e768e
merges r20050 from ruby_1_9_1 into trunk.
...
* array.c (rb_ary_sort_bang): refactoring.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-08 11:09:20 +00:00
nobu
4927a7c77a
* array.c (rb_ary_join): do not repeat self in a recursive array.
...
[ruby-dev:37019]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-03 18:28:34 +00:00
yugui
c2ded64653
* array.c (rb_ary_take_first_or_last): renamed rb_ary_partial more
...
appropriately.
(ary_take_pos_flags): new enum. makes the fourth argument of
rb_ary_take_first_or_last more descriptive.
(rb_ary_partial): renamed rb_ary_partial0 more appropriately.
takes a new parameter klass for what class to instanciate.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-03 04:13:04 +00:00
yugui
b4729e2db3
* array.c (ary_partial0): recovers mistakenly feature change at r19723.
...
Array#[m,n] had returned an Array even for an instance of a
subclass.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-31 09:46:31 +00:00
wanabe
5eacf68c2a
* array.c (rb_ary_decrement_share): fix to work recycling
...
shared-array without the following. [ruby-dev:36991]
* array.c (ary_make_substitution): don't recycle substitution array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-31 03:49:29 +00:00
mame
ea4ae3302d
* array.c (rb_ary_permutation): hide temporal array.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-30 12:35:04 +00:00
mame
e2cb0b9766
* array.c (rb_ary_sort_bang): remove SEGV when replacing array with
...
embedded one during sort.
* test/ruby/test_array.rb (test_sort!): add tests for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29 17:24:44 +00:00
mame
2e51b7f9da
* array.c (rb_ary_splice): remove redundant check.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29 16:35:47 +00:00
mame
0d83c7b6c2
* array.c (rb_ary_sort_bang): replacing array during sort broke
...
invariant of array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29 14:58:30 +00:00
mame
2a3d7b5992
* revert the previous wrong commit; sorry.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29 14:40:31 +00:00
mame
7451e34428
* array.c (rb_ary_sort_bang): replacing array during sort broke
...
invariant of array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29 14:30:07 +00:00
nobu
4f577310ce
* array.c (rb_ary_sample): fixed sizes and randomness.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-24 15:14:44 +00:00
wanabe
b29f3640e9
* array.c: don't recycle shared-array while sort!.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-17 15:51:35 +00:00