summaryrefslogtreecommitdiff
path: root/array.c
AgeCommit message (Collapse)Author
2012-11-15* range.c (range_bsearch): fix some bugs: a documentation bug, a wrongmame
condition, missed break in switch/case, and workaround for GCC optimization. See [ruby-core:49364] in detail. A great patch from Heesob Park. [Bug #7352] [Feature #4766] * array.c (rb_ary_bsearch): fix similar bug (missed break). * test/ruby/test_range.rb: add two test cases for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-14* array.c (rb_ary_bsearch): add Array#bsearch for binary search.mame
[ruby-core:36390] [Feature #4766] * test/ruby/test_array.rb: add a test for above. * range.c (range_bsearch): add Range#bsearch for binary search. [ruby-core:36390] [Feature #4766] * test/ruby/test_range.rb: add a test for above * NEWS: added the two new methods. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-12* probes.d: add DTrace probe declarations. [ruby-core:27448]tenderlove
* array.c (empty_ary_alloc, ary_new): added array create DTrace probe. * compile.c (rb_insns_name): allowing DTrace probes to access instruction sequence name. * Makefile.in: translate probes.d file to appropriate header file. * common.mk: declare dependencies on the DTrace header. * configure.in: add a test for existence of DTrace. * eval.c (setup_exception): add a probe for when an exception is raised. * gc.c: Add DTrace probes for mark begin and end, and sweep begin and end. * hash.c (empty_hash_alloc): Add a probe for hash allocation. * insns.def: Add probes for function entry and return. * internal.h: function declaration for compile.c change. * load.c (rb_f_load): add probes for `load` entry and exit, require entry and exit, and wrapping search_required for load path search. * object.c (rb_obj_alloc): added a probe for general object creation. * parse.y (yycompile0): added a probe around parse and compile phase. * string.c (empty_str_alloc, str_new): DTrace probes for string allocation. * test/dtrace/*: tests for DTrace probes. * vm.c (vm_invoke_proc): add probes for function return on exception raise, hash create, and instruction sequence execution. * vm_core.h: add probe declarations for function entry and exit. * vm_dump.c: add probes header file. * vm_eval.c (vm_call0_cfunc, vm_call0_cfunc_with_frame): add probe on function entry and return. * vm_exec.c: expose instruction number to instruction name function. * vm_insnshelper.c: add function entry and exit probes for cfunc methods. * vm_insnhelper.h: vm usage information is always collected, so uncomment the functions. 12 19:14:50 2012 Akinori MUSHA <knu@iDaemons.org> * configure.in (isinf, isnan): isinf() and isnan() are macros on DragonFly which cannot be found by AC_REPLACE_FUNCS(). This workaround enforces the fact that they exist on DragonFly. 12 15:59:38 2012 Shugo Maeda <shugo@ruby-lang.org> * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo), vm_insnhelper.c (vm_search_method): revert r37616 because it's too slow. [ruby-dev:46477] * test/ruby/test_refinement.rb (test_inline_method_cache): skip the test until the bug is fixed efficiently. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-09* array.c (rb_ary_splice): fix r37583 doesn't condier the case whennaruse
beg > array length. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-09array.c: speedup Array#unshift by using space in shared arraynobu
* array.c: speedup Array#unshift by using space in shared array. [Feature #6638] - when array owns its shared array (ARY_SHARED_NUM == 1), and there is enough space then try unshift values directly into shared array. - when resulting array is big (~>64 items) then make it shared with enough room for future #unshifts, and then insert into shared array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-09array.c: use shared array in rb_ary_slicenobu
* array.c (rb_ary_splice): use shared array in rb_ary_slice. [Feature #6638] - use ary_ensure_room_for_push when rb_ary_slice used to add at the end of array, cause rb_ary_concat use rb_ary_slice. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-09array.c: make array really suitable for queuenobu
* array.c (ary_ensure_room_for_push): make array really suitable for queue. [Feature #6638] when array is shared (which happens after Array#shift), and ARY_SHARED_NUM == 1 (which is very often when array used as queue), then make rb_ary_push push directly into shared array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-09array.c: steal shared array's container when ARY_SHARED_NUM == 1nobu
* array.c (rb_ary_modify): steal shared array's container when ARY_SHARED_NUM == 1. [Feature #6638] - Do not allocate new memory in rb_ary_modify when ARY_SHARED_NUM == 1 and length almost same. - Store ARY_CAPA instead of RARRAY_LEN in ary_make_shared, to make it useful. - Fix rb_ary_sort_bang accordantly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-07* array.c: Fix mistake in rdoc of Array#uniq.marcandre
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06* array.c (rb_ary_cycle): Support for Array#cycle.sizemarcandre
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06* array.c (rb_ary_repeated_combination): Support for repeated_combination.sizemarcandre
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06* array.c (rb_ary_repeated_permutation): Support for repeated_permutation.sizemarcandre
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06* array.c (rb_ary_combination): Support for Array#combination.sizemarcandre
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06* array.c (rb_ary_permutation): Support for Array#permutation.sizemarcandre
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06* array.c: Support for Enumerator#size in trivial cases:marcandre
each, each_index, reverse_each, sort_by, collect, collect!, select, select!, keep_if, reject, reject!, delete_if [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-05Expose whether two arrays are sharedshirosaki
* array.c (rb_ary_shared_with_p): new function. Expose whether two arrays are shared (read-only, C only). * include/ruby/intern.h (rb_ary_shared_with_p): declare. Patch by Greg Price. [ruby-core:47970] [Bug #7158] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-04* array.c (recursive_equal): fix to return true when self and otherglass
are resized to same size and the current index become out of range. * test/ruby/test_array.rb: add a test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-03* array.c (recursive_equal): fix not to make invalid pointers whenglass
self and other are resized to same size in #== of their elements. [ruby-dev:46373] [Feature #6177] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-02* array.c (recursive_equal): performance improvement.glass
[ruby-dev:45412] [Feature #6177] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20* include/ruby/ruby.h: add C APIs.nari
VALUE rb_newobj_of(VALUE klass, VALUE flags) #define NEWOBJ_OF(obj,type,klass,flags) These allow to change a allocation strategy depending on klass or flags. * gc.c: ditto * array.c: use new C API. * bignum.c: ditto * class.c: ditto * complex.c: ditto * ext/socket/ancdata.c: ditto * ext/socket/option.c: ditto * hash.c: ditto * io.c: ditto * marshal.c: ditto * numeric.c: ditto * object.c: ditto * random.c: ditto * range.c: ditto * rational.c: ditto * re.c: ditto * string.c: ditto * struct.c: ditto [Feature #7177][Feature #7047] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-09array.c: use rb_random_ulong_limitednobu
* array.c (rb_ary_sample): use rb_random_ulong_limited, since precision of long may be larger than double. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-20remove garbages.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-19array.c, enum.c: TypeError in zipnobu
* array.c (take_items), enum.c (enum_zip): raise TypeError at non-enumerable objects, not NoMethodError. [ruby-dev:46145] [Bug #7038] * vm_eval.c (rb_check_block_call): check_funcall variant with block function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-13* array.c (rb_ary_diff, rb_ary_uniq):zzak
Enhance documentation for array uniqueness Based on a patch by Robin Dupret [Bug #6872] [ruby-core:47209] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-13* array.c (rb_ary_select):zzak
Update documentation for Array#select * enum.c (enum_find_all, enum_reject): Update documentation for Enumerable#find_all and Enumerable#reject Based on a patch by Jeff Saracco [Bug #6908] [ruby-core:47285] [Fixes #166 on github] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-17Add documentation about Array#join(nil). [Bug#5915]naruse
We talked about this and it is like following: * maybe ary.join(nil) should always use empty string as a separator, but it disables to specify $, as a seprator through variables. * if nil means '', the conversion is to_s. to_s is not accepted. * nil is a special value, so special behavior is allowed. * use of $ variables is not recommended, so it is not worth to change current behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-14array.c: fill with nilnobu
* array.c (rb_get_values_at): fill with nil out of range. [ruby-core:43678] [Bug #6203] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-14array.c: no infection by unused separatornobu
* array.c (rb_ary_join): should not infected by separator if it is not used. [ruby-core:42161][Bug #5902] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-05* array.c (rb_ary_aref): Added a description of the behavior ofdrbrain
index positioning. [Bug #6680] * array.c (rb_ary_aset): ditto. Reordered sentences for clarity. * string.c (rb_str_aref_m): Added a description of the behavior of index positioning git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-03* array.c (rb_ary_aref): Updated documentation to indicate thedrbrain
starting index is an index into the array or string. Updated examples to show behavior of indexes at the end of an array or string. Based on patch by Marcus Stollsteimer. [Bug #6680] * array.c (rb_ary_aset): ditto. * string.c (rb_str_aref): ditto. Also added descriptive argument names to call-seq section. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-19* array.c (ary_reverse): use ansi style declaration.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-31* array.c: Updated Array documentation formatting. Patch by Zacharydrbrain
Scott. [ruby-trunk - Feature #6517] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14* include/ruby/intern.h: Add rb_check_arity, rb_error_arity [#6085]marcandre
* array.c: Use rb_check_arity / rb_error_arity * class.c: ditto * enumerator.c: ditto * eval.c: ditto * file.c: ditto * hash.c: ditto * numeric.c: ditto * proc.c: ditto * process.c: ditto * random.c: ditto * re.c: ditto * signal.c: ditto * string.c: ditto * struct.c: ditto * transcode.c: ditto * vm_eval.c: ditto * vm_insnhelper.c: ditto & implementation of rb_error_arity * test/ruby/test_arity.rb: tests for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-08* array.c (rb_ary_cat): new function to concat objects into array.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-10* array.c: Fix rdoc for Array#select!marcandre
patched by b t [ruby-core:42478] [Bug #5998] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-05Fix typoayumin
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-04* array.c (rb_ary_sample): add examples for Array#sample.ayumin
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-15* array.c (rb_ary_reject_bang, rb_ary_delete_if): update rdoc.nobu
documentation from Thomas Leitner <t_leitner AT gmx.at> in [ruby-core:41616]. [Bug #5752] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-10* array.c (rb_ary_initialize): Improve explanation of Array.newdrbrain
parameters. Patch by Alvaro Pereyra Rabanal. [Ruby 1.9 - Bug #5425] * array.c (rb_ary_s_try_convert): Fix typo (try => tries) * array.c (rb_ary_rindex): Add spacing for block. * array.c (rb_ary_uniq_bang): Describe block * array.c (rb_ary_uniq): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-10* array.c: Add a description to Array, minor cleanups. Patch bydrbrain
Andrea Singh. [Ruby 1.9 - Bug #5412] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-06* array.c: Use + for arguments described in documentation to allowdrbrain
rdoc -C2 to work better. Remove <code> from method references to allow cross-references in HTML documentation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-03* array.c (rb_ary_initalize): Make Array.new description matchdrbrain
call-seq. Patch by Henry Maddocks. [Ruby 1.9 - Bug #5344] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-03 * array.c (rb_ary_initialize): Add output for examples. Patch bydrbrain
Jonathan Mukai. [Ruby 1.9 - Bug #5216] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-03* array.c (rb_ary_s_create): Add example results for Array::[]. Patchdrbrain
by Jonathan Mukai. [Ruby 1.9 - Bug #5215] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29* array.c (ary_join_1): should not copy the encoding of non-stringnobu
element after string element. [ruby-core:39776] [Bug #5379] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29* use RB_TYPE_P which is optimized for constant types, instead ofnobu
comparison with TYPE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-29* array.c (rb_ary_set_len): new function to set array length.nobu
* vm_eval.c (method_missing): set the length of argv array, to mark arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-26* array.c: Fix typo. https://github.com/ruby/ruby/pull/36shyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-21* array.c (rb_ary_delete_at_m): use simple array literal in rdoc.naruse
patched by samuel tonini. [ruby-core:38310] [Bug #5066] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-03* array.c (ary_reject_bang): should not remove elements which arenobu
not yielded. [Bug #2545] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e