[前][次][番号順一覧][スレッド一覧]

ruby-changes:32515

From: nobu <ko1@a...>
Date: Tue, 14 Jan 2014 15:58:47 +0900 (JST)
Subject: [ruby-changes:32515] nobu:r44594 (trunk): bigdecimal.c: backword compatibility as gem

nobu	2014-01-14 15:58:43 +0900 (Tue, 14 Jan 2014)

  New Revision: 44594

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44594

  Log:
    bigdecimal.c: backword compatibility as gem
    
    * ext/bigdecimal/bigdecimal.c (CLASS_NAME): macro to wrap
      depending on PRIsVALUE for 1.9.  [Backport #9406]

  Modified files:
    trunk/ChangeLog
    trunk/ext/bigdecimal/bigdecimal.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44593)
+++ ChangeLog	(revision 44594)
@@ -1,11 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Tue Jan 14 14:52:04 2014  Nobuyoshi Nakada  <nobu@r...>
+Tue Jan 14 15:58:43 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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
 	  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@g...>
 
 	* vm_exec.c (cfp): Fixes a SEGV issue in r44554.
Index: ext/bigdecimal/bigdecimal.c
===================================================================
--- ext/bigdecimal/bigdecimal.c	(revision 44593)
+++ ext/bigdecimal/bigdecimal.c	(revision 44594)
@@ -105,9 +105,10 @@ static ID id_eq; https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L105
 #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: https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L285
 
 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, V https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2272
 	}
 	/* 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) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2531
 	/* 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);
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]