aboutsummaryrefslogtreecommitdiffstats
path: root/array.c
Commit message (Collapse)AuthorAgeFilesLines
* * include/ruby/ruby.h: rename OBJ_WRITE and OBJ_WRITTEN intoko12013-12-201-4/+4
| | | | | | | | | | | | RB_OBJ_WRITE and RB_OBJ_WRITTEN. * array.c, class.c, compile.c, hash.c, internal.h, iseq.c, proc.c, process.c, re.c, string.c, variable.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: fix comment to remove the word "shady".ko12013-12-131-2/+2
| | | | | | | | * variable.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: More doc examples for Array#{map|collect}{!} using both formsmarcandre2013-12-111-2/+5
| | | | | | * enum.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c, hash.c: add saltnobu2013-12-101-0/+1
| | | | | | | | * array.c (rb_ary_hash): add salt to differentiate false and empty array. [ruby-core:58993] [Bug #9231] * hash.c (rb_any_hash, rb_hash_hash): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c: id_randomnobu2013-12-081-12/+8
| | | | | | | * array.c (rb_ary_shuffle_bang, rb_ary_sample): share id_random instead of no longer used sym_random. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_shuffle_bang, rb_ary_sample): rename local variables.ktsj2013-12-081-8/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_shuffle_bang, rb_ary_sample): checkktsj2013-12-081-2/+20
| | | | | | | | | unknown keywords. * test/ruby/test_array.rb (test_shuffle, test_sample): tests for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_or): use RHASH_TBL_RAW instead of RHASH_TBLcharliesome2013-12-081-1/+1
| | | | | | | | | | | | * process.c (rb_execarg_fixup): use RHASH_TBL_RAW and insert write barriers where appropriate * vm.c (kwmerge_i): use RHASH_TBL_RAW * vm.c (HASH_ASET): use rb_hash_aset instead of calling directly into st_insert git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c: prefer lhs elementsnobu2013-12-051-1/+17
| | | | | | | | | * array.c (rb_ary_or): lhs elements are prefered, so should not replace with rhs elements. * test/ruby/test_array.rb (test_OR_in_order): import the test failed by r43969 from rubyspec/core/array/union_spec.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: detect recursion for allnobu2013-12-031-22/+11
| | | | | | | * hash.c (rb_hash): detect recursion for all `hash' methods. each `hash' methods no longer need to use rb_exec_recursive(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_uniq_bang): remove duplicate code.glass2013-12-031-34/+14
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (ary_add_hash): set and return values because string keysglass2013-12-031-6/+7
| | | | | | | | | | | | | | | | will be frozen. [ruby-core:58809] [Bug #9202] * array.c (rb_ary_uniq_bang): ditto. * array.c (rb_ary_or): ditto. * array.c (rb_ary_uniq): ditto. * test/ruby/test_array.rb: tests for above. The patch is from normalperson (Eric Wong). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby/ruby.h: RB_BLOCK_CALL_FUNC_ARGLISTnobu2013-11-291-2/+2
| | | | | | | * include/ruby/ruby.h (RB_BLOCK_CALL_FUNC_ARGLIST): for declaration argument list of rb_block_call_func. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c, enum.c, range.c: rb_block_call_func compatiblenobu2013-11-291-1/+2
| | | | | | | | | | | * array.c (take_i), range.c (first_i): make rb_block_call_func compatible. * enum.c (collect_all, DEFINE_ENUMFUNCS): add blockarg. * enum.c ({min,max,minmax,chunk,slicebefore}_ii): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby/ruby.h: add blockarg to rb_block_call_funcnobu2013-11-291-2/+2
| | | | | | | * include/ruby/ruby.h (rb_block_call_func): add blockarg. block function can take block argument, e.g., proc {|&blockarg| ...}. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* should not ignore the rest of recursive constructsnobu2013-11-261-1/+1
| | | | | | | | | | | | | * array.c (rb_ary_hash): should not ignore the rest of recursive constructs. * hash.c (rb_hash_hash): ditto. * range.c (range_hash): ditto. * struct.c (rb_struct_hash): ditto. * test/-ext-/test_recursion.rb (TestRecursion): separate from test/ruby/test_thread.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: do not use ruby_sized_xrealloc() and ruby_sized_xfree()ko12013-11-251-2/+1
| | | | | | | | | | | | | | | if HAVE_MALLOC_USABLE_SIZE (or _WIN32) is defined. We don't need these function if malloc_usable_size() is available. * gc.c: catch up this change. * gc.c: define HAVE_MALLOC_USABLE_SIZE on _WIN32. * array.c (ary_resize_capa): do not use ruby_sized_xfree() with local variable to avoid "unused local variable" warning. This change only has few impact. * string.c (rb_str_resize): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: [DOC] Add note about negative indices in Array overviewzzak2013-11-071-1/+3
| | | | | | | By @ckaenzig [Fixes GH-427] https://github.com/ruby/ruby/pull/427 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_shuffle_bang): use RARRAY_PTR_USE() without WBglass2013-11-071-15/+14
| | | | | | because there are not new relations. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_sample): use rb_ary_dup().glass2013-11-071-2/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_shift_m): use RARRAY_PTR_USE() without WB becauseglass2013-11-061-1/+3
| | | | | | there are not new relations. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_reverse): use RARRAY_PTR_USE().glass2013-11-061-5/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_sample): use RARRAY_AREF() and RARRAY_PTR_USE()glass2013-11-061-37/+28
| | | | | | instead of RARRAY_PTR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_and): defer hash creation and some refactoring.glass2013-11-061-7/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_uniq_bang): use rb_ary_modify_check() instead ofglass2013-10-301-2/+2
| | | | | | rb_ary_modify() because the array will be unshared soon. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_zip): some refactoring.glass2013-10-291-21/+28
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_uniq_bang): use st_foreach() instead of for loop.glass2013-10-291-11/+21
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: Add Array#to_h [Feature #7292]marcandre2013-10-231-0/+27
| | | | | | * enum.c: Add Enumerable#to_h git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c, internal.h: rename ruby_xsizefree/realloc toko12013-10-171-6/+6
| | | | | | | | | | rb_sized_free/realloc. * array.c: catch up these changes. * string.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, string.c: use ruby_xsizedfree() and ruby_xsizedrealloc().ko12013-10-171-9/+12
| | | | | | | | * internal.h (SIZED_REALLOC_N): define a macro as REALLOC_N(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c: reduce RARRAY_LEN and ARY_CAPAnobu2013-10-151-37/+50
| | | | | | | * array.c: reduce use of RARRAY_LEN and ARY_CAPA when object is not modified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_or): remove unused variables.glass2013-10-101-3/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_or): use rb_hash_keys().glass2013-10-101-14/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_compact_bang): use ary_resize_smaller().glass2013-10-101-4/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c: use rb_hash_valuesnobu2013-10-081-2/+1
| | | | | | | | * array.c (rb_ary_uniq): use rb_hash_values(), as well as the case no block is given. * internal.h: define rb_hash_values() as internal API. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c: set classnobu2013-10-081-0/+1
| | | | | | | * array.c (rb_ary_uniq): set class of the return value to the receiver class. fix failure in TestArray#test_array_subclass. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c: remove unused variablesnobu2013-10-081-2/+1
| | | | | | | * array.c (rb_ary_uniq): remove no longer used local variables since r43194. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_uniq): use rb_hash_keys().glass2013-10-081-7/+1
| | | | | | | | * internal.h: define rb_hash_keys() as internal API. * hash.c (rb_hash_keys): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c: minor performance improvementnobu2013-09-291-7/+16
| | | | | | | | | | | | | * array.c (sort_2): minor performance improvement by replacing rb_funcall() with rb_funcallv. * array.c (rb_ary_bsearch, recursive_cmp, rb_ary_cycle_size): ditto. * array.c (descending_factorial, binomial_coefficient): ditto. * array.c (rb_ary_repeated_permutation_size): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: rename RARRAY_RAWPTR() to RARRAY_CONST_PTR().ko12013-09-251-42/+42
| | | | | | | | | | | | | | | RARRAY_RAWPTR(ary) returns (const VALUE *) type pointer and usecase of this macro is not acquire raw pointer, but acquire read-only pointer. So we rename to better name. RSTRUCT_RAWPTR() is also renamed to RSTRUCT_CONST_PTR() (I expect that nobody use it). * array.c, compile.c, cont.c, enumerator.c, gc.c, proc.c, random.c, string.c, struct.c, thread.c, vm_eval.c, vm_insnhelper.c: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c: optimized equalitynobu2013-08-271-9/+33
| | | | | | | | | * array.c (rb_ary_index, rb_ary_rindex): use optimized equality to improve performance. [Feature #8820] * vm_insnhelper.c (rb_equal_opt): optimized equality function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * remove trailing spaces.nobu2013-08-261-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_splice): use RARRAY_PTR_USE() without WB becauseko12013-08-261-2/+3
| | | | | | | | | | | | | there are not new relations. * enum.c (enum_sort_by): ditto. * struct.c (setup_struct): use RARRAY_RAWPTR(). * vm_eval.c (yield_under): ditto. * ext/pathname/pathname.c (path_entries): use RARRAY_AREF(). * ext/pathname/pathname.c (path_s_glob): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (ary_ensure_room_for_push): fix typo in r42658.kazu2013-08-261-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (ary_make_shared): shared ary as shady. Need more effort toko12013-08-231-9/+11
| | | | | | | | | | | | make it normal object. * array.c (rb_ary_modify): use RARRAY_PTR_USE() without WB because there are not new relations. * array.c (ary_ensure_room_for_unshift): use RARRAY_RAWPTR() because there are not new relations. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: introduce ARY_SHARED_OCCUPIED(shared).ko12013-08-231-5/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_zip): performance implement by usingglass2013-08-041-5/+5
| | | | | | ALLOCA_N() to allocate tmp buffer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_zip): use rb_ary_new2() to create bufferglass2013-08-021-5/+4
| | | | | | if rb_block_arity() > 1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_zip): performance improvement by avoidingglass2013-08-021-13/+29
| | | | | | array creation if rb_block_arity() > 1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (ary_memcpy): cast to int to suppress a warning.ko12013-07-261-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e