merge revision(s) 39594,39596: [Backport #8010]

* enumerator.c (enumerator_with_index_i): allow Bignum as offset, to
	  get rid of conversion exception and integer overflow.
	  [ruby-dev:47131] [Bug #8010]

	* enumerator.c (enumerator_with_index):  Restore handling of a nil memo
	  from r39594.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@43960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2013-12-02 14:29:37 +00:00
parent 83c337f29a
commit b851418bb7
6 changed files with 28 additions and 10 deletions

View file

@ -2383,8 +2383,8 @@ fix_succ(VALUE num)
* (-1).next #=> 0
*/
static VALUE
int_succ(VALUE num)
VALUE
rb_int_succ(VALUE num)
{
if (FIXNUM_P(num)) {
long i = FIX2LONG(num) + 1;
@ -2393,6 +2393,8 @@ int_succ(VALUE num)
return rb_funcall(num, '+', 1, INT2FIX(1));
}
#define int_succ rb_int_succ
/*
* call-seq:
* int.pred -> integer
@ -2403,8 +2405,8 @@ int_succ(VALUE num)
* (-1).pred #=> -2
*/
static VALUE
int_pred(VALUE num)
VALUE
rb_int_pred(VALUE num)
{
if (FIXNUM_P(num)) {
long i = FIX2LONG(num) - 1;
@ -2413,6 +2415,8 @@ int_pred(VALUE num)
return rb_funcall(num, '-', 1, INT2FIX(1));
}
#define int_pred rb_int_pred
VALUE
rb_enc_uint_chr(unsigned int code, rb_encoding *enc)
{