nobu
87d8a3b9ce
* array.c (rb_ary_clear): should not unshare embedded array, and
...
should make unshared array embedded.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-19 03:33:33 +00:00
nobu
10a90fbce8
* array.c (rb_ary_clear): no need to duplicate buffer just before
...
clearing.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-18 12:20:14 +00:00
akr
58772d7110
* array.c (rb_ary_product): clear uninitialized elements in temporary
...
array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-06 10:56:45 +00:00
nobu
c22b223cb0
* array.c (rb_ary_product): need to set the length in order to get
...
the entries marked. [ruby-dev:41540]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-06 01:44:38 +00:00
nobu
45f6fbf339
* removed trailing spaces.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 18:51:39 +00:00
shyouhei
11cef3cca3
* array.c (rb_ary_product): Use tmpary instead, to ensure marking
...
arrays by GC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-28 08:51:41 +00:00
shyouhei
97b1c9edd2
* array.c (rb_ary_product): Do not rely on GC, t0 should be
...
checked explicitly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-28 02:43:34 +00:00
marcandre
7729de4d91
* array.c: Documentation: change => in call-seq to ->.
...
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
2010-05-17 21:07:33 +00:00
marcandre
4afa9ed041
* array.c: Harmonize documentation, in particular regarding:
...
- 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
2010-05-13 05:49:55 +00:00
marcandre
b140b77926
* array.c (rb_ary_fetch, rb_ary_splice, rb_ary_store): Improve IndexError
...
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
2010-05-08 04:49:53 +00:00
matz
38ae996706
* array.c (rb_ary_repeated_permutation): new method added. a patch
...
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
2010-04-16 07:24:04 +00:00
marcandre
f3d2f9e4d1
* array.c (rb_ary_permutation): Remove limitation for lengthy permutations
...
[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
2010-04-07 17:36:15 +00:00
marcandre
93f4317f89
* array.c (rb_ary_product): Don't limit based on size when a block is given
...
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
2010-04-03 20:59:56 +00:00
marcandre
94ab139bc9
* array.c (rb_ary_product): Make defensive copy in case of block...
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-02 22:44:17 +00:00
marcandre
d0a98a0e90
* array.c (rb_ary_product): Test for reentry
...
* test/ruby/test_array.rb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-02 22:25:49 +00:00
marcandre
7cf6ecd9de
* array.c (rb_ary_product): Accept a block [ruby-core:29045]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-02 21:56:34 +00:00
akr
9ce419a45c
* array.c (rb_ary_uniq_bang): the array is already unique if the
...
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
2010-03-20 04:27:32 +00:00
matz
8b55878d2a
* enum.c (enum_join): remove Enumerable#join. [ruby-core:24786]
...
* 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
2010-03-13 05:55:46 +00:00
matz
006a8ba77f
* array.c (rb_ary_select_bang): select! removes all elements for
...
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
2010-03-03 05:35:08 +00:00
naruse
6b6a41d1e7
* array.c (rb_ary_push_m): use rb_ary_modify instead of
...
rb_ary_modify_check.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-15 04:13:43 +00:00
matz
5d325e6a9e
* array.c (rb_ary_delete): RDoc update. a patch from Hugh Sasse.
...
[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
2010-02-13 08:08:19 +00:00
nobu
f3f43cdbee
* array.c (rb_ary_push_m, rb_ary_unshift_m, rb_ary_aset),
...
(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
2010-02-10 07:31:06 +00:00
nobu
8a4c9b0b77
* array.c (rb_ary_rotate): new methods, Array#rotate! and
...
Array#rotate. [ruby-dev:17194]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-21 02:15:48 +00:00
nobu
2cb9f63bab
* array.c (rb_ary_reverse_m): copy directly.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-21 02:12:07 +00:00
matz
0580ba0611
* array.c (rb_ary_to_ary): do not use #respond_to? to detect
...
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
2009-10-29 04:55:10 +00:00
marcandre
705c567194
* string.c: rdoc for <=>, casecmp
...
* 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
2009-10-28 04:50:09 +00:00
marcandre
8d446fe1eb
* array.c (rb_ary_cmp): Array#<=> returns nil when comparison fails
...
[ruby-core:26316]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-26 11:06:17 +00:00
matz
40229f892c
* array.c (rb_ary_{times, shuffle_bang, sample}): reducing macro
...
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
2009-10-05 14:35:39 +00:00
nobu
1a78256861
* array.c (ary_make_shared): should count frozen array itself.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-02 17:49:52 +00:00
marcandre
1796522f10
* thread.c (rb_exec_recursive_outer, rb_exec_recursive): Added method to 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
2009-09-15 21:30:50 +00:00
nobu
31b7ae00c0
* include/ruby/st.h (st_hash_func): use st_index_t.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-08 13:10:04 +00:00
nobu
34401f9014
* array.c (permute0): use chars for boolean array.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-03 06:56:57 +00:00
nobu
49816a2552
* 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/trunk@24364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-03 06:48:46 +00:00
nobu
330be69e43
* array.c (rb_ary_{permutation,combination,product}): must not use
...
ary_discard on strings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-03 04:05:37 +00:00
nobu
3770ac98ff
* array.c (rb_ary_combination, rb_ary_product): prevent from GC.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-02 11:09:12 +00:00
nobu
0f6d9dfc96
* array.c: suppressed shorten-64-to-32 warnings.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 07:22:42 +00:00
akr
0101958745
* array.c (recursive_hash): reject recursive key.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-17 07:49:06 +00:00
matz
ae487eda6e
* array.c (recursive_join): raise ArgumentError for joining
...
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
2009-07-17 02:04:37 +00:00
matz
57264a4fae
* array.c (rb_ary_sample): RDoc update. a patch from Florian
...
Frank. [ruby-core:24347]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-16 05:10:18 +00:00
nobu
38867cc115
* array.c (ary_join_1): should recurse for element array.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-10 15:11:43 +00:00
nobu
af8f8e5b0e
* array.c (recursive_join): use obj to tell if recursion occurs.
...
[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
2009-07-10 07:30:08 +00:00
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
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
knu
1e90c8ceb3
Fix a typo.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-29 13:50:59 +00:00
knu
8f706b2d44
* array.c (rb_ary_nitems, Init_Array): Axe Array#nitems().
...
cf. [ruby-dev:34676]-[ruby-dev:34713]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-28 09:12:28 +00:00
knu
fbf3e22a3d
* array.c (rb_ary_slice_bang): Call rb_ary_modify_check() at the
...
beginning. [rubyspec]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-28 07:52:34 +00:00
knu
c3e7816a78
* array.c (rb_ary_slice_bang): Return an empty array instead of
...
nil when pos is valid and len is adjusted from a valid value to
zero; caught by RubySpec.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 11:18:50 +00:00
knu
7c52f1ed7a
* array.c (rb_ary_slice_bang): Be consistent with Array#slice()
...
and String#slice!(). Just return nil when a negative length or
out of boundary index is given instead of raising an exception
via internal functions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-23 09:01:19 +00:00
akr
f73c84542c
* array.c (rb_ary_compact_bang): fix reallocation size.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-22 08:19:04 +00:00
nobu
feead4dca5
* array.c (flatten): check if reentered. [ruby-dev:34798]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-22 03:40:57 +00:00
matz
9d27c792c2
* array.c (flatten): free memo hash table before raising exception.
...
[ruby-dev:34789]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-22 00:57:47 +00:00
nagai
1ef64a6624
* array.c (flatten): fix memory leak.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-21 21:41:09 +00:00
matz
f827d95685
* array.c (rb_ary_compact_bang): avoid forceful realloc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-21 07:50:27 +00:00
nobu
9afd5465e2
* array.c (rb_ary_sort_bang): should not free shared pointer, and set
...
shared. [ruby-dev:34732]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-17 05:01:52 +00:00
matz
c39e8c6e85
* array.c (rb_ary_sort_bang): stop memory leak. [ruby-dev:34726]
...
* re.c (rb_reg_search): need to free allocated buffer in re_register.
* regexec.c (onig_region_new): more pedantic malloc check.
* regexec.c (onig_region_resize): ditto.
* regexec.c (STATE_CHECK_BUFF_INIT): ditto.
* regexec.c (onig_region_copy): use onig_region_resize.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-16 18:27:01 +00:00
knu
921fb6ae25
* array.c (rb_ary_count): Override Enumerable#count for better
...
performance.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-14 03:46:37 +00:00
nobu
265e855ca7
* array.c (rb_ary_sort_bang): freeze temporary array.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-08 06:14:36 +00:00
matz
5abd77d925
array.c: typo fixed; sorry!
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-08 01:46:07 +00:00
matz
12a498ff49
* array.c (sort_reentered): reentered check may be called from
...
Array#sort.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-08 01:44:50 +00:00
nobu
4c2b10e0d6
* array.c (sort_1, sort_2): check for reentered and if elements are
...
accessible. [ruby-core:16679]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-08 00:51:55 +00:00
nobu
68c67143b2
* array.c (sort_1, sort_2): check reentered. [ruby-core:16679]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-07 23:56:33 +00:00
matz
a7d8042774
* array.c (rb_ary_slice_bang): should adjust length before making
...
sub-array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-05 03:13:32 +00:00
matz
646988189a
* array.c (rb_ary_dup): should dupe corresponding information.
...
[ruby-dev:34581]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-05 02:40:13 +00:00
nobu
a4c08752f8
* array.c (flatten): returns an instance of same class.
...
[ruby-core:16554]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-25 03:37:57 +00:00
nobu
d1263ff544
* array.c (rb_ary_take_while, rb_ary_drop_while): removed unused
...
variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-15 04:29:48 +00:00
matz
6be7386218
* array.c (ary_new): new integer overflow check condition.
...
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
2008-04-14 03:58:35 +00:00
knu
181f815591
* enum.c (enum_cycle): Make Enumerable#cycle do a finite loop when
...
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
2008-04-13 14:59:55 +00:00
knu
033a32b4c1
* enum.c (enum_find_index): Add support for find_index(obj);
...
[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
2008-04-11 07:58:06 +00:00
knu
e8b41deead
Fix mistake in the previous commit.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-10 10:34:49 +00:00
knu
c04ad1d7e4
* array.c (rb_ary_pop_m, rb_ary_shift_m): Update documents for
...
#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
2008-04-10 10:25:44 +00:00
mame
b6c9957058
* array.c (ary_new): fix size check. [ruby-dev:34123]
...
* 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
2008-03-25 10:13:03 +00:00
mame
89afc5431b
* array.c (rb_ary_take, rb_ary_take_while, rb_ary_drop,
...
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
2008-03-17 13:28:46 +00:00
matz
92f510a9d9
* array.c (rb_ary_slice_bang): should not use rb_ary_subseq()
...
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
2008-03-13 16:39:45 +00:00
matz
8f14847366
* array.c (rb_ary_combination): argument check before creating
...
Enumerator.
* array.c (rb_ary_permutation): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-11 16:15:14 +00:00
akr
861219ce4a
fix doc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-09 01:04:46 +00:00
akr
7a23e86588
fix rdoc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-07 10:18:18 +00:00
matz
39787ea14d
* numeric.c (fix_to_s): avoid rb_scan_args() when no argument
...
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
2008-03-05 05:22:17 +00:00