summaryrefslogtreecommitdiff
path: root/enum.c
AgeCommit message (Collapse)Author
2014-04-15enum.c: make each_slice and each_cons more efficientnobu
* enum.c (enum_each_slice, enum_each_cons): make more efficient by allocating less and recycling block argument arrays if possible. [Fixes GH-596] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-12revert [Bug #9605]nobu
* enum.c: revert r45284, r45286, r45292. it conflicts with existing behaviors. [Bug #9605] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-08enum.c: suppress warningsnobu
* enum.c (each_val_i): svalue is no longer used. [ruby-core:61340] [Bug #9605] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-07enum.c: yield multiple valuesnobu
* enum.c (find_i): yield multiple values instead of a packed array, so that lambda block can work. with tests by Alex Rothenberg. [ruby-core:61340] [Bug #9605] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-14* enum.c: Enumerable#{min,min_by,max,max_by} extended to take anakr
optional argument. (nmin_cmp): New function. (nmin_block_cmp): Ditto (nmin_filter): Ditto. (nmin_i): Ditto. (nmin_run): Ditto. (enum_min): Call nmin_run if the optional argument is given. (nmin_max): Ditto. (nmin_min_by): Ditto. (nmin_max_by): Ditto. * range.c: Range#{min,max} extended to take an optional argument. (range_min): Call range_first if the optional argument is given. (range_max): Call rb_call_super if the optional argument is given. [ruby-core:57111] [Feature #8887] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-10* enum.c: document that it is OK to take more than available by @mvidner ↵hsbt
[fix GH-525] [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-21* enum.c: [DOC] Add simple example of Enumerable#zip [ci skip]zzak
Patch by @nruth on documenting-ruby/ruby#22 https://github.com/documenting-ruby/ruby/pull/22 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-23* array.c: Have to_h raise on elements that are not key-value pairs [#9239]marcandre
* enum.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-11* array.c: More doc examples for Array#{map|collect}{!} using both formsmarcandre
* enum.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29ruby/ruby.h, enum.c, vm_eval.c: constify argvnobu
* include/ruby/ruby.h (RB_BLOCK_CALL_FUNC_ARGLIST): constify argv. * enum.c (rb_enum_values_pack): ditto. * vm_eval.c (rb_block_call, rb_check_block_call): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29ruby/ruby.h: RB_BLOCK_CALL_FUNC_ARGLISTnobu
* 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
2013-11-29array.c, enum.c, range.c: rb_block_call_func compatiblenobu
* 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
2013-11-29ruby/ruby.h: add blockarg to rb_block_call_funcnobu
* 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
2013-10-23* array.c: Add Array#to_h [Feature #7292]marcandre
* enum.c: Add Enumerable#to_h git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-20* enum.c: [DOC] Enumerable#to_a accepts arguments [GH-388]zzak
Patch by @kachick https://github.com/ruby/ruby/pull/388 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-26* array.c (rb_ary_splice): use RARRAY_PTR_USE() without WB becauseko1
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
2013-07-10internal.h: STATIC_ASSERTnobu
* internal.h (STATIC_ASSERT): move from enum.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-26intern.h: define rb_enumerator_size_funcnobu
* include/ruby/intern.h (rb_enumerator_size_func): define strict function declaration for rb_enumeratorize_with_size(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07* internal.h (numberof): Gathered from various files.akr
* array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c, load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c, error.c, ruby.c: Remove the definitions of numberof. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* include/ruby/ruby.h: constify RBasic::klass and addko1
RBASIC_CLASS(obj) macro which returns a class of `obj'. This change is a part of RGENGC branch [ruby-trunk - Feature #8339]. * object.c: add new function rb_obj_reveal(). This function reveal interal (hidden) object by rb_obj_hide(). Note that do not change class before and after hiding. Only permitted example is: klass = RBASIC_CLASS(obj); rb_obj_hide(obj); .... rb_obj_reveal(obj, klass); TODO: API design. rb_obj_reveal() should be replaced with others. TODO: modify constified variables using cast may be harmful for compiler's analysis and optimizaton. Any idea to prohibt inserting RBasic::klass directly? If rename RBasic::klass and force to use RBASIC_CLASS(obj), then all codes such as `RBASIC(obj)->klass' will be compilation error. Is it acceptable? (We have similar experience at Ruby 1.9, for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)". * internal.h: add some macros. * RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal object. * RBASIC_SET_CLASS(obj, cls) set RBasic::klass. * RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS without write barrier (planned). * RCLASS_SET_SUPER(a, b) set super class of a. * array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c, file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c, parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c, string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c: Use above macros and functions to access RBasic::klass. * ext/coverage/coverage.c, ext/readline/readline.c, ext/socket/ancdata.c, ext/socket/init.c, * ext/zlib/zlib.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* *.c, parse.y, insns.def: use RARRAY_AREF/ASET macroko1
instead of using RARRAY_PTR(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-01* enum.c (Enumerable#chunk): fix grammar of error messageeregon
for symbols beginning with an underscore [Bug #8351] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04enum.c: avoid inadvertent symbol creationnobu
* enum.c (enum_inject): avoid inadvertent symbol creation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-22* enum.c (Enumerable#chunk: Improved examples, grammar, and formattingzzak
Patch by Dan Bernier and Rich Bruchal of newhaven.rb [Github documenting-ruby/ruby#8] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-05* enumerator.c: Use to_enum for Enumerable methods returning Enumerators.marcandre
This makes Lazy#cycle no longer needed, so it was removed. Make Enumerator#chunk and slice_before return lazy Enumerators. [Bug #7715] * internal.h: Remove ref to rb_enum_cycle_size; no longer needed * enum.c: Make enum_cycle_size static. * test/ruby/test_lazy_enumerator.rb: Test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-24* enum.c (enum_zip): Fix error messagemarcandre
* array.c (take_items): Same, for Array#zip [Bug #7706] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-02* array.c, enum.c, insns.def, io.c, numeric.c, parse.y, process.c,ko1
range.c: use prepared IDs. A patch from charliesome (Charlie Somerville). [Bug #7495] * common.mk: add dependency to id.h. * common.mk: replace ID_H_INCLUDES with id.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01adjust style.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06enum.c: prefixnobu
* enum.c (rb_enum_cycle_size): prefix with rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06* enumerator.c: Support for lazy.cycle.sizemarcandre
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06* enum.c (enum_cycle): Support for Enumerable#cycle.sizemarcandre
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06* enum.c (enum_each_cons): Support for Enumerable#each_cons.sizemarcandre
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06* enum.c (enum_each_slice): Support for Enumerable#each_slice.sizemarcandre
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06* enum.c: Support for enumerators created by Enumerable with forwarding:marcandre
find_all, reject, ... [Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-24enum.c: id_callnobu
* enum.c (enum_find): use id_call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-24enum.c: id_callnobu
* enum.c (id_call): intern first and share. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37018 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_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-08-18Merge branch 'pullreq/129' into trunkayumin
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24* enum.c (enum_count): Enumerable#count no longer uses #size whendrbrain
counting elements. Patch by Nobuhiro IMAI. [ruby-trunk - Bug #6473] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-14* variable.c (trace_ev): Removed "not reached" comment as this line isdrbrain
reached. * variable.c (rb_obj_remove_instance_variable): Replaced "not reached" comment with the UNREACHABLE macro. * variable.c (rb_mod_const_missing): ditto. * variable.c (rb_mod_remove_cvar): ditto. * enum.c (first_i): ditto. * string.c (rb_str_aref): ditto. * string.c (str_byte_aref): ditto. * string.c (rb_to_id): ditto. * io.c (rb_io_fmode_modestr): ditto. * io.c (rb_io_oflags_modestr): ditto. * pack.c (num2i32): ditto. * vm_eval.c (rb_method_missing): ditto. * vm_eval.c (rb_f_throw): ditto. * dir.c (dir_read): ditto. * win32/win32.c (child_result): ditto. * struct.c (rb_struct_getmember): ditto. * struct.c (rb_struct_set): ditto. * struct.c (rb_struct_aref_id): ditto. * eval.c (rb_f_raise): ditto. * process.c (rb_f_exit_bang): ditto. * process.c (rb_f_exit): ditto. * process.c (rb_f_abort): ditto. * ext/-test-/iter/break.c (iter_break_value): ditto. * ext/pty/pty.c (pty_check): ditto. * ext/openssl/ossl_pkey.c (ossl_pkey_new): ditto. * ext/readline/readline.c (rb_remove_history): ditto. * ext/stringio/stringio.c (strio_unimpl): ditto. * numeric.c (num_sadded): ditto. * numeric.c (num_init_copy): ditto. * numeric.c (rb_num2ll): ditto. * numeric.c (rb_num2ull): ditto. * vm_insnhelper.c (call_cfunc): ditto. * ruby.c (opt_W_getter): ditto. * bignum.c (rb_big_coerce): ditto. * file.c (rb_f_test): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-19* enum.c (zip_i): variadic argument needs explicit cast on theshugo
platforms where VALUE is longer than int. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-16* enum.c (enum_take): allocate buffer array before iteration, as wellnobu
as enum_first did. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-16* enum.c (enum_first): remove duplication.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-15* enum.c (rb_enum_values_pack): rename from enum_values_pack, andshugo
remove static. * enumerator.c (lazy_init_iterator, lazy_init_yielder, lazy_select_func, lazy_reject_func, lazy_grep_func): handle multiple values correctly. * enumerator.c (lazy_grep): change the behavior when a block is given, to be consistent with Enumerable#grep. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14* enumerator.c (lazy_take): add Enumerable::Lazy#take.shugo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-17* enum.c (enum_each_slice): arrays to be yielded can be newlynobu
created in the block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-17* enum.c: move work variables to objects not to let called blocksnobu
access stack area out of scope. [Bug #5801] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-16* enum.c (id_lshift): use constant ID.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-09update doc.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e