zzak
a563664e06
* enumerator.c: [DOC] Fix example to show Enumerator#peek behavior
...
Patch by Erik Hollembeak [Bug #9814 ] [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-25 03:00:17 +00:00
nobu
abfa2b6c7e
enumerator.c: adjust style [ci skip]
...
* enumerator.c (yielder_yield_push): Insert a break after the
method return value. [fix GH-617]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-24 06:05:35 +00:00
akr
ddd155842f
* enum.c: Enumerable#slice_after implemented.
...
* enumerator.c: Enumerator::Lazy#slice_after implemented.
Requested by Tsuyoshi Sawada. [ruby-core:58123] [Feature #9071 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-18 00:06:05 +00:00
ko1
57e557908a
* enumerator.c (enumerator_block_call): use PARRAY_CONST_PTR()
...
instead of RARRAY_PTR().
* io.c (rb_io_s_popen): ditto.
* numeric.c (num_step_size): ditto.
* vm_eval.c (rb_apply): ditto.
* vm_eval.c (rb_eval_cmd): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-17 04:20:16 +00:00
nobu
520f0fec95
enumerator.c: should not store local variable address
...
* enumerator.c (enumerator_with_index): should not store local variable
address to memoise the arguments. it is invalidated after the return.
[ruby-core:58692] [Bug #9178 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-30 07:25:17 +00:00
nobu
7566c49068
ruby/ruby.h: RB_BLOCK_CALL_FUNC_ARGLIST
...
* 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-29 07:59:14 +00:00
nobu
9f45081627
ruby/ruby.h: add blockarg to rb_block_call_func
...
* 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-11-29 02:26:48 +00:00
glass
eb86296497
* enumerator.c (append_method): use RARRAY_CONST_PTR().
...
* enumerator.c (lazy_init_iterator): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-08 01:52:07 +00:00
ko1
c5e08b764e
* add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
...
safe functions during garbage collection such as xfree().
On default, T_DATA objects are freed at same points as fianlizers.
This approach protects issues such as reported by [ruby-dev:35578].
However, freeing T_DATA objects immediately helps heap usage.
Most of T_DATA (in other words, most of dfree functions) are safe.
However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default
for safety.
* cont.c: ditto.
* dir.c: ditto.
* encoding.c: ditto.
* enumerator.c: ditto.
* error.c: ditto.
* file.c: ditto.
* gc.c: ditto.
* io.c: ditto.
* iseq.c: ditto.
* marshal.c: ditto.
* parse.y: ditto.
* proc.c: ditto.
* process.c: ditto.
* random.c: ditto.
* thread.c: ditto.
* time.c: ditto.
* transcode.c: ditto.
* variable.c: ditto.
* vm.c: ditto.
* vm_backtrace.c: ditto.
* vm_trace.c: ditto.
* ext/bigdecimal/bigdecimal.c: ditto.
* ext/objspace/objspace.c: ditto.
* ext/stringio/stringio.c: ditto.
* ext/strscan/strscan.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 11:16:54 +00:00
ko1
dc626dbab3
* include/ruby/ruby.h: rename RARRAY_RAWPTR() to RARRAY_CONST_PTR().
...
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
2013-09-25 08:24:34 +00:00
zzak
df3e4b8306
* enumerator.c: [DOC] Enumerator#each arguments documentation [GH-388]
...
Patch by @kachick https://github.com/ruby/ruby/pull/388
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-20 15:51:17 +00:00
nobu
1af4196cdf
enumerator.c: rb_check_funcall
...
* enumerator.c (enumerator_size): use rb_check_funcall() instead of
respond_to? and call.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-27 07:56:52 +00:00
nobu
9b4b5ad27c
enumerator.c: add comment
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-27 07:56:17 +00:00
nobu
a5f18c1f9d
enumerator.c: check arg size
...
* enumerator.c (enumerator_each): ensure argument array size is int.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-27 07:51:27 +00:00
marcandre
ca7f52a32a
* enumerator.c: Allow Enumerator size argument to be any callable.
...
Patch by Avdi Grimm. [bug #8641 ] [ruby-core:56032] [fix GH-362]
* test/ruby/test_enumerator.rb: Test for above
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-27 02:50:08 +00:00
nobu
8d644d6a6e
enumerator.c: fix non-single argument
...
* enumerator.c (lazy_zip_func): fix non-single argument. fix
out-of-bound access and pack multiple yielded values.
[ruby-core:56383] [Bug #8735 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-08 15:10:37 +00:00
zzak
b649592c4a
* enumerator.c: [DOC] Remove reference to Enumerator::Lazy#cycle
...
Patch by @kachick [Fixes GH-372]
https://github.com/ruby/ruby/pull/372
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-04 21:15:08 +00:00
knu
075752a836
Add a frozenness check to Enumerator::Generator#initialize.
...
* enumerator.c (generator_init): Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-29 12:06:42 +00:00
knu
8cb0de91c4
Add a frozenness check to Enumerator#initialize.
...
* enumerator.c (enumerator_init): Add a frozenness check to
prevent a frozen Enumerator object from being reinitialized with
a different enumerable object. This is the least we should do,
and more fixes will follow. [Fixes GH-368] Patch by Kenichi
Kamiya.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-29 12:06:39 +00:00
nobu
da0c4e5e11
enumerator.c: lazyenum_size
...
* enumerator.c (lazyenum_size): adjust arguments.
* enumerator.c (enumerable_lazy): use lazyenum_size() instead of
enum_size().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-28 04:26:21 +00:00
nobu
0f73dde5da
enumerator.c: adjust indent
...
* enumerator.c (rb_enumeratorize_with_size): adjust indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-27 07:51:55 +00:00
nobu
e5178a2550
enumerator.c: use rb_enumerator_size_func
...
* enumerator.c (rb_enumeratorize_with_size): use strict definition
rb_enumerator_size_func.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-26 14:22:23 +00:00
nobu
5e2f227d21
intern.h: define rb_enumerator_size_func
...
* 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-26 13:43:22 +00:00
akr
e12df5ef40
Update doc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-21 13:54:31 +00:00
nobu
8a28e97ae9
enumerator.c: use VALUE
...
* enumerator.c (inspect_enumerator): use VALUE instead of mere char*
by using rb_sprintf() and rb_id2str().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-18 02:05:17 +00:00
nobu
6b6ca88925
enumerator.c: append_method
...
* enumerator.c (append_method): extract from inspect_enumerator().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-18 02:03:07 +00:00
nobu
15b88811d6
enumerator.c: fix style
...
* enumerator.c (enumerator_initialize): no cuddle up else.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-18 01:58:00 +00:00
ko1
aacd771046
* *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
...
instead of using RARRAY_PTR().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:56:22 +00:00
zzak
9ef4e13459
* array.c: Document synonymous methods, by windwiny [GH-277]
...
* bignum.c: ditto
* complex.c: ditto
* dir.c: ditto
* encoding.c: ditto
* enumerator.c: ditto
* numeric.c: ditto
* proc.c: ditto
* re.c: ditto
* string.c: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-12 02:59:07 +00:00
naruse
5f257cf403
* enumerator.c (enumerator_with_index): try to convert given offset to
...
integer. fix bug introduced in r39594.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-11 09:47:15 +00:00
kazu
dbec401c11
use INT2FIX(0) instead of INT2NUM(0).
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-05 16:31:19 +00:00
drbrain
6c77ae07a5
* enumerator.c (enumerator_with_index): Restore handling of a nil memo
...
from r39594.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-05 03:25:55 +00:00
nobu
4a429c11e1
enumerator.c: allow Bignum for with_index
...
* enumerator.c (enumerator_with_index_i): allow Bignum as offset, to
get rid of conversion exception and integer overflow.
[ruby-dev:47131] [Bug #8010 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-05 01:20:20 +00:00
marcandre
673e1b9276
* enumerator.c: rdoc fix
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-23 17:38:12 +00:00
nobu
4b81b403eb
enumerator.c: suppress warnings
...
* enumerator.c (lazy_zip_arrays_func, lazy_zip_func, lazy_take_func),
(lazy_drop_func, lazy_drop_while_func): suppress uninitialized
instance vriable warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-20 03:15:32 +00:00
marcandre
757bbe8737
* enumerator.c: Remove rdoc that is obsolete because of lazy
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-05 05:52:39 +00:00
marcandre
1677cbce9d
* enumerator.c: Use to_enum for Enumerable methods returning Enumerators.
...
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-02-05 03:49:59 +00:00
marcandre
44cd5f21e9
* enumerator.c: Finalize and document Lazy.new. [Bug #7248 ]
...
Add Lazy#to_enum and simplify Lazy#size.
* test/ruby/test_lazy_enumerator.rb: tests for above
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-05 03:49:41 +00:00
marcandre
5af821c6e9
* enumerator.c: Fix and improve rdoc for to_enum
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-05 03:49:22 +00:00
marcandre
aab2f788d7
* enumerator.c (lazy_zip): raise error for bad arguments
...
[Bug #7706 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-24 07:50:33 +00:00
marcandre
1af390b1ea
* enumerator.c: Optimize Lazy#zip when passed only arrays
...
[Bug #7706 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-24 07:05:42 +00:00
marcandre
41d6ba8765
* enumerator.c: Fix state handling for Lazy#zip
...
[bug #7696 ] [bug #7691 ]
* test/ruby/test_lazy_enumerator.rb: test for above
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-24 06:24:22 +00:00
marcandre
9d94a1a5a1
* enumerator.c: Fix state handling for Lazy#drop
...
[bug #7696 ] [bug #7691 ]
* test/ruby/test_lazy_enumerator.rb: test for above
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-24 06:23:42 +00:00
marcandre
bcbeb5d008
* enumerator.c: Fix state handling for Lazy#drop_while
...
[bug #7696 ] [bug #7691 ]
* test/ruby/test_lazy_enumerator.rb: test for above
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-24 06:23:07 +00:00
marcandre
de0e887635
* enumerator.c: Fix state handling for Lazy#take
...
[bug #7696 ]
* test/ruby/test_lazy_enumerator.rb: test for above
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-24 06:22:34 +00:00
shugo
7dd52f895f
* enumerator.c (lazy_flat_map_func): flat_map should call each only
...
when the value of a block returns a forcable object.
[ruby-core:51401] [Bug #7690 ]
* enumerator.c (lazy_flat_map): add documentation.
* test/ruby/test_lazy_enumerator.rb: related test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-14 08:36:15 +00:00
marcandre
8ca504214d
* enumerator.c: Require block for Lazy#{take|drop}_while [Bug #7692 ]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-14 07:42:43 +00:00
marcandre
62e67609b6
* enumerator.c: Fix size for Enumerator::Lazy#flat_map
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-14 01:19:12 +00:00
marcandre
19c530d8c1
* enumerator.c: Fix rdoc typo (thanks to Yutaka HARA)
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-13 00:19:10 +00:00
nobu
e878df745c
use RB_TYPE_P
...
* enumerator.c (enumerator_initialize), eval.c (rb_using_refinement),
(add_activated_refinement), numeric.c (num_interval_step_size),
parse.y (arg, match_op_gen, cond0), range.c (range_bsearch),
vm_insnhelper.c (vm_get_iclass): use RB_TYPE_P() to optimize.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-29 12:22:01 +00:00