summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-03 03:25:12 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-03 03:25:12 +0000
commitaaed10716a55d659309a8636a41a8e159347a32c (patch)
treed9a33dfbc48ae8022a308636fe535ad3ec3052c6 /include
parentc95b3a16bdf6c9a40c3ce23734b38c1982609712 (diff)
intern.h: SIZED_ENUMERATOR
* include/ruby/intern.h (SIZED_ENUMERATOR): separate from RETURN_SIZED_ENUMERATOR. * string.c (rb_str_enumerate_chars): get rid of calling rb_block_given_p() twice. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-rw-r--r--include/ruby/intern.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index b10c9c6..00474a7 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -234,10 +234,12 @@ VALUE rb_enumeratorize_with_size(VALUE, VALUE, int, const VALUE *, rb_enumerator
#define rb_enumeratorize_with_size(obj, id, argc, argv, size_fn) \
rb_enumeratorize_with_size(obj, id, argc, argv, (rb_enumerator_size_func *)(size_fn))
#endif
+#define SIZED_ENUMERATOR(obj, argc, argv, size_fn) \
+ rb_enumeratorize_with_size((obj), ID2SYM(rb_frame_this_func()), \
+ (argc), (argv), (size_fn))
#define RETURN_SIZED_ENUMERATOR(obj, argc, argv, size_fn) do { \
if (!rb_block_given_p()) \
- return rb_enumeratorize_with_size((obj), ID2SYM(rb_frame_this_func()),\
- (argc), (argv), (size_fn)); \
+ return SIZED_ENUMERATOR(obj, argc, argv, size_fn); \
} while (0)
#define RETURN_ENUMERATOR(obj, argc, argv) RETURN_SIZED_ENUMERATOR(obj, argc, argv, 0)
/* error.c */