yugui
7ad4bd137d
merges r24364 from trunk into ruby_1_9_1.
...
--
* array.c (rb_ary_{permutation,combination}): disallow reentrance
with continuation since work-buffers cannot restore.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@24459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-08 15:32:09 +00:00
yugui
0ddc830573
merges r23557 and r23563 from trunk into ruby_1_9_1.
...
--
* 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.
--
* test/ruby/test_hash.rb (TestHash::test_equal2): recursive hashes
are handled properly now. ref: [ruby-core:23402]
* test/ruby/test_m17n.rb (TestM17N#test_sprintf_p): test fixed
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@23759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-20 09:06:35 +00:00
yugui
3c84bb3147
merges r23361 from trunk into ruby_1_9_1.
...
--
* 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/branches/ruby_1_9_1@23513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-21 14:47:11 +00:00
yugui
5453b6d4a7
merges r23359 from trunk into ruby_1_9_1.
...
--
* array.c (rb_ary_sample): negative sample number is invalid.
[ruby-core:23374]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@23512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-21 14:47:02 +00:00
yugui
974d1ae287
merges r23191 from trunk into ruby_1_9_1.
...
--
* 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/branches/ruby_1_9_1@23339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-04 12:30:55 +00:00
yugui
f1edc86441
merges r21780 from trunk into ruby_1_9_1.
...
* array.c (rb_ary_aset): fixed arguments evaluation order.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-28 09:23:30 +00:00
yugui
1011775a39
introduces r21693 again and merges r21713
...
* array.c (take_items), enum.c (enum_zip): tries to convert to
array first. [ruby-core:21442]
--
* 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/branches/ruby_1_9_1@21814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-28 09:20:03 +00:00
yugui
a40ca8c047
* reverts r21693.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-20 10:14:18 +00:00
yugui
07efe466f6
merges r21678 from trunk into ruby_1_9_1.
...
* 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/branches/ruby_1_9_1@21693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-20 09:53:31 +00:00
yugui
2458172de8
merges r20840 from trunk into ruby_1_9_1.
...
* 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/branches/ruby_1_9_1@20873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-19 11:36:48 +00:00
yugui
8a1d754612
merges r20839 from trunk into ruby_1_9_1.
...
* array.c (rb_ary_pop_m): use enum ary_take_pos_flags.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-19 11:35:04 +00:00
yugui
242351be25
merges r20356 from trunk into ruby_1_9_1.
...
* 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/branches/ruby_1_9_1@20414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-30 09:23:35 +00:00
yugui
ce6be57ae0
merges r20103 from trunk into ruby_1_9_1.
...
* 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/branches/ruby_1_9_1@20111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-04 13:37:17 +00:00
yugui
98aa505358
* 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/branches/ruby_1_9_1@20096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-03 04:13:04 +00:00
yugui
9ebb879904
merges r20071 from trunk into ruby_1_9_1.
...
* 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/branches/ruby_1_9_1@20081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-31 13:56:07 +00:00
yugui
b5035524df
* 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/branches/ruby_1_9_1@20076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-31 09:46:31 +00:00
mame
4bdc35fea9
* array.c (rb_ary_permutation): hide temporal array.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-30 12:35:04 +00:00
yugui
aec8f3e864
* array.c (rb_ary_sort_bang): refactoring.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29 17:43:46 +00:00
mame
b508535564
* 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/branches/ruby_1_9_1@20048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29 17:24:44 +00:00
mame
b3c49a752e
* array.c (rb_ary_splice): remove redundant check.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29 16:35:47 +00:00
mame
523683afbb
* array.c (rb_ary_sort_bang): replacing array during sort broke
...
invariant of array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29 14:58:30 +00:00
mame
6e1b227fc3
* revert the previous wrong commit; sorry.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29 14:40:31 +00:00
mame
8058e93f5e
* array.c (rb_ary_sort_bang): replacing array during sort broke
...
invariant of array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@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
wanabe
331cd4eed6
* array.c: recycle shared-array when it isn't referenced.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-17 13:09:33 +00:00
yugui
6e738bf2b1
* array.c (ary_resize_capa): renamed RESIZE_CAPA.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-17 10:42:11 +00:00
usa
6c4895c78a
* array.c (RESIZE_CAPA): check whether len is longer than capacity.
...
* array.c (rb_ary_compact_bang): resize ary before changing capacity.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-15 13:21:37 +00:00
yugui
c86ce094e2
* include/ruby/ruby.h: embeds the elements of an array into its
...
struct RArray for # of elements <= 3.
* array.c: ditto.
* gc.c (gc_mark_children): following the change of struct RArray.
* ext/tk/tcltklib.c (ip_ruby_cmp): ditto.
* parse.y (coverage): ditto.
* proc.c (curry): ditto.
* .gdbinit: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-09 05:47:04 +00:00
akr
45d7c84f2a
fix a typo.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-07 11:07:31 +00:00
nobu
ee5c9fb983
* array.c (rb_ary_sample): performance improvement for huge array.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20 07:40:03 +00:00
nobu
6523eee836
* array.c (rb_ary_sample): get rid of infinite loop. #455
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20 03:28:34 +00:00
nobu
5f9c188d97
* include/ruby/ruby.h (rb_intern_const): tiny optimization.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-16 00:20:31 +00:00
shugo
f433d710d0
* object.c (rb_obj_untrusted): new method Object#untrusted?.
...
(rb_obj_untrust): new method Object#untrust.
(rb_obj_trust): new method Object#trust.
* array.c, debug.c, time.c, include/ruby/ruby.h, re.c, variable.c,
string.c, io.c, dir.c, vm_method.c, struct.c, class.c, hash.c,
ruby.c, marshal.c: fixes for Object#untrusted?.
* test/ruby/test_module.rb, test/ruby/test_array.rb,
test/ruby/test_object.rb, test/ruby/test_string.rb,
test/ruby/test_marshal.rb, test/ruby/test_hash.rb: added tests for
Object#untrusted?.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 07:25:05 +00:00
matz
e605839355
* array.c (rb_ary_delete): Array#delete to return deleted element.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 09:12:24 +00:00
matz
9295fd4b59
* array.c (rb_ary_sample): rename #choice to #sample. in
...
addition, sample takes optional argument, a la #first.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-11 10:00:47 +00:00
nobu
f1ff09fbf6
* array.c (rb_ary_sort_bang): reset to real class.
...
* file.c (rb_find_file_ext, rb_find_file): ditto.
* io.c (io_reopen): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-05 20:08:33 +00:00
nobu
a58e3d763b
* array.c (rb_ary_sort_bang): respect overridden <=> for String and
...
Fixnum. [ruby-core:17708]
* include/ruby/node.h (NOEX_BASIC): basic definition method flag.
* include/ruby/intern.h, vm_method.c (rb_method_basic_definition_p):
new function to check if the method is not redefined after the
initialization.
* vm_method.c (rb_obj_respond_to): use rb_method_basic_definition_p.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-04 18:29:55 +00:00
nobu
b49106dfd7
* array.c (rb_ary_tmp_new): added.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-04 10:21:46 +00:00
akr
6372357ad5
* array.c (rb_ary_fill): don't raise even if length is negative.
...
[ruby-core:17483], [ruby-core:17661]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-09 12:01:08 +00:00
nobu
365f1cd57e
* array.c (rb_ary_fill): check if beg is too big.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 04:19:47 +00:00
nobu
d02ef8342c
* array.c (rb_ary_fill): not depend on unspecified behavior at integer
...
overflow. reported by Vincenzo Iozzo <snagg AT openssl.it>.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-25 06:28:53 +00:00
nobu
e1a45b10b6
* array.c (rb_ary_store, rb_ary_splice): not depend on unspecified
...
behavior at integer overflow.
* string.c (str_buf_cat): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-20 06:42:07 +00:00
shyouhei
3af6dda231
* array.c (ary_new, rb_ary_initialize, rb_ary_store,
...
rb_ary_aplice, rb_ary_times): integer overflows should be
checked. based on patches from Drew Yao <ayao at apple.com>
fixed CVE-2008-2726
* string.c (rb_str_buf_append): fixed unsafe use of alloca,
which led memory corruption. based on a patch from Drew Yao
<ayao at apple.com> fixed CVE-2008-2726
* sprintf.c (rb_str_format): backported from trunk.
* intern.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-19 23:12:46 +00:00
mame
9e412b83a0
* array.c (rb_ary_zip): ANSI style.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-11 17:43:52 +00:00
matz
dd6f7fbaef
* array.c (rb_ary_shuffle_bang): update RDoc. [ruby-dev:35034]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 08:44:30 +00:00
nobu
5a647a3f5f
* include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.
...
* *.c: no cache in init functions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 09:25:32 +00:00
ko1
72ba13aa8e
* array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,
...
enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c,
io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c,
string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c,
vm.c, gc.c:
allocated memory objects by xmalloc (ruby_xmalloc) should be
freed by xfree (ruby_xfree).
* ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c,
ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c,
ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c,
ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c,
ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c:
ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08 10:01:40 +00:00
matz
1b039e2a92
* array.c (rb_ary_delete_if): should return enumerator if no block
...
is given. [ruby-dev:34901]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31 09:27:42 +00:00
knu
3a3e250975
* enum.c (enum_count, count_all_i, Init_Enumerable),
...
array.c (rb_ary_count): If no argument or block is given, count
the number of all elements.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-29 19:18:54 +00:00