bigdecimal.c: backword compatibility as gem
* ext/bigdecimal/bigdecimal.c (CLASS_NAME): macro to wrap depending on PRIsVALUE for 1.9. [Backport #9406] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
88383b058b
commit
0a8988c132
@ -1,11 +1,11 @@
|
|||||||
Tue Jan 14 14:52:04 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue Jan 14 15:58:43 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/bigdecimal/bigdecimal.c (CLASS_NAME): macro to wrap
|
||||||
|
depending on PRIsVALUE for 1.9. [Backport #9406]
|
||||||
|
|
||||||
* ext/bigdecimal/bigdecimal.c (DECIMAL_SIZE_OF_BITS): fallback
|
* ext/bigdecimal/bigdecimal.c (DECIMAL_SIZE_OF_BITS): fallback
|
||||||
definition for 2.1 or older. [ruby-core:59750] [Backport #9406]
|
definition for 2.1 or older. [ruby-core:59750] [Backport #9406]
|
||||||
|
|
||||||
* ext/bigdecimal/bigdecimal.c (raise_with_class): fallback definition
|
|
||||||
for 1.9.
|
|
||||||
|
|
||||||
Tue Jan 14 11:28:44 2014 Yuki Yugui Sonoda <yugui@google.com>
|
Tue Jan 14 11:28:44 2014 Yuki Yugui Sonoda <yugui@google.com>
|
||||||
|
|
||||||
* vm_exec.c (cfp): Fixes a SEGV issue in r44554.
|
* vm_exec.c (cfp): Fixes a SEGV issue in r44554.
|
||||||
|
@ -105,9 +105,10 @@ static ID id_eq;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PRIsVALUE
|
#ifdef PRIsVALUE
|
||||||
# define raise_with_class(e, pre, post, obj) rb_raise((e), pre "%" PRIsVALUE post, rb_obj_class(obj))
|
# define CLASS_NAME(obj) rb_obj_class(obj)
|
||||||
#else
|
#else
|
||||||
# define raise_with_class(e, pre, post, obj) rb_raise((e), pre "%s" post, rb_obj_classname(obj))
|
# define PRIsVALUE "s"
|
||||||
|
# define CLASS_NAME(obj) rb_obj_classname(obj)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -284,9 +285,9 @@ SomeOneMayDoIt:
|
|||||||
|
|
||||||
unable_to_coerce_without_prec:
|
unable_to_coerce_without_prec:
|
||||||
if (must) {
|
if (must) {
|
||||||
raise_with_class(rb_eArgError,
|
rb_raise(rb_eArgError,
|
||||||
"", " can't be coerced into BigDecimal without a precision",
|
"%"PRIsVALUE" can't be coerced into BigDecimal without a precision",
|
||||||
v);
|
CLASS_NAME(v));
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -2271,9 +2272,9 @@ BigDecimal_power(int argc, VALUE*argv, VALUE self)
|
|||||||
}
|
}
|
||||||
/* fall through */
|
/* fall through */
|
||||||
default:
|
default:
|
||||||
raise_with_class(rb_eTypeError,
|
rb_raise(rb_eTypeError,
|
||||||
"wrong argument type ", " (expected scalar Numeric)",
|
"wrong argument type %"PRIsVALUE" (expected scalar Numeric)",
|
||||||
vexp);
|
CLASS_NAME(vexp));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VpIsZero(x)) {
|
if (VpIsZero(x)) {
|
||||||
@ -2530,9 +2531,9 @@ BigDecimal_new(int argc, VALUE *argv)
|
|||||||
/* fall through */
|
/* fall through */
|
||||||
case T_RATIONAL:
|
case T_RATIONAL:
|
||||||
if (NIL_P(nFig)) {
|
if (NIL_P(nFig)) {
|
||||||
raise_with_class(rb_eArgError,
|
rb_raise(rb_eArgError,
|
||||||
"can't omit precision for a ", ".",
|
"can't omit precision for a %"PRIsVALUE".",
|
||||||
iniValue);
|
CLASS_NAME(iniValue));
|
||||||
}
|
}
|
||||||
return GetVpValueWithPrec(iniValue, mf, 1);
|
return GetVpValueWithPrec(iniValue, mf, 1);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user