summaryrefslogtreecommitdiff
path: root/ext/bigdecimal/bigdecimal.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-14 06:58:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-14 06:58:43 +0000
commit0a8988c132164a3a39508fabb863f82c22f7063a (patch)
tree9910fe966f2e0b38cae72862a8b17efa0606d4fa /ext/bigdecimal/bigdecimal.c
parent88383b058bbe68ecc020c9f5e35f9cb7f63923d9 (diff)
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
Diffstat (limited to 'ext/bigdecimal/bigdecimal.c')
-rw-r--r--ext/bigdecimal/bigdecimal.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index e8889b8..3459300 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -105,9 +105,10 @@ static ID id_eq;
#endif
#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
-# 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
/*
@@ -284,9 +285,9 @@ SomeOneMayDoIt:
unable_to_coerce_without_prec:
if (must) {
- raise_with_class(rb_eArgError,
- "", " can't be coerced into BigDecimal without a precision",
- v);
+ rb_raise(rb_eArgError,
+ "%"PRIsVALUE" can't be coerced into BigDecimal without a precision",
+ CLASS_NAME(v));
}
return NULL;
}
@@ -2271,9 +2272,9 @@ BigDecimal_power(int argc, VALUE*argv, VALUE self)
}
/* fall through */
default:
- raise_with_class(rb_eTypeError,
- "wrong argument type ", " (expected scalar Numeric)",
- vexp);
+ rb_raise(rb_eTypeError,
+ "wrong argument type %"PRIsVALUE" (expected scalar Numeric)",
+ CLASS_NAME(vexp));
}
if (VpIsZero(x)) {
@@ -2530,9 +2531,9 @@ BigDecimal_new(int argc, VALUE *argv)
/* fall through */
case T_RATIONAL:
if (NIL_P(nFig)) {
- raise_with_class(rb_eArgError,
- "can't omit precision for a ", ".",
- iniValue);
+ rb_raise(rb_eArgError,
+ "can't omit precision for a %"PRIsVALUE".",
+ CLASS_NAME(iniValue));
}
return GetVpValueWithPrec(iniValue, mf, 1);