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

ruby-changes:27833

From: mrkn <ko1@a...>
Date: Sat, 23 Mar 2013 23:31:05 +0900 (JST)
Subject: [ruby-changes:27833] mrkn:r39885 (trunk): * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): Use Qnil and NIL_P

mrkn	2013-03-23 23:30:56 +0900 (Sat, 23 Mar 2013)

  New Revision: 39885

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

  Log:
    * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): Use Qnil and NIL_P
      instead of (VALUE)0 as a return value.
    
    * ext/bigdecimal/bigdecimal.c (BigDecimal_div): ditto.
    
    * ext/bigdecimal/bigdecimal.c (BigDecimal_divremain): ditto.
    
    * ext/bigdecimal/bigdecimal.c (BigDecimal_remainder): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/ext/bigdecimal/bigdecimal.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39884)
+++ ChangeLog	(revision 39885)
@@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Mar 23 23:28:00 2013  Kenta Murata  <mrkn@m...>
+
+	* ext/bigdecimal/bigdecimal.c (BigDecimal_divide): Use Qnil and NIL_P
+	  instead of (VALUE)0 as a return value.
+
+	* ext/bigdecimal/bigdecimal.c (BigDecimal_div): ditto.
+
+	* ext/bigdecimal/bigdecimal.c (BigDecimal_divremain): ditto.
+
+	* ext/bigdecimal/bigdecimal.c (BigDecimal_remainder): ditto.
+
 Sat Mar 23 17:39:49 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* vm_eval.c (check_funcall_respond_to): preserve passed_block, which
Index: ext/bigdecimal/bigdecimal.c
===================================================================
--- ext/bigdecimal/bigdecimal.c	(revision 39884)
+++ ext/bigdecimal/bigdecimal.c	(revision 39885)
@@ -1211,7 +1211,7 @@ BigDecimal_divide(Real **c, Real **res, https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L1211
     GUARD_OBJ((*c), VpCreateRbObject(mx, "#0"));
     GUARD_OBJ((*res), VpCreateRbObject((mx+1) * 2 +(VpBaseFig() + 1), "#0"));
     VpDivd(*c, *res, a, b);
-    return (VALUE)0;
+    return Qnil;
 }
 
  /* call-seq:
@@ -1240,7 +1240,7 @@ BigDecimal_div(VALUE self, VALUE r) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L1240
     ENTER(5);
     Real *c=NULL, *res=NULL, *div = NULL;
     r = BigDecimal_divide(&c, &res, &div, self, r);
-    if (r != (VALUE)0) return r; /* coerced by other */
+    if (!NIL_P(r)) return r; /* coerced by other */
     SAVE(c); SAVE(res); SAVE(div);
     /* a/b = c + r/b */
     /* c xxxxx
@@ -1401,7 +1401,7 @@ BigDecimal_divremain(VALUE self, VALUE r https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L1401
 
     *dv = d;
     *rv = ff;
-    return (VALUE)0;
+    return Qnil;
 }
 
 /* Returns the remainder from dividing by the value.
@@ -1414,7 +1414,7 @@ BigDecimal_remainder(VALUE self, VALUE r https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L1414
     VALUE  f;
     Real  *d, *rv = 0;
     f = BigDecimal_divremain(self, r, &d, &rv);
-    if (f != (VALUE)0) return f;
+    if (!NIL_P(f)) return f;
     return ToValue(rv);
 }
 

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

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