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

ruby-changes:32923

From: nobu <ko1@a...>
Date: Sun, 16 Feb 2014 16:53:22 +0900 (JST)
Subject: [ruby-changes:32923] nobu:r45002 (trunk): bigdecimal.c: refine macros

nobu	2014-02-16 16:53:18 +0900 (Sun, 16 Feb 2014)

  New Revision: 45002

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

  Log:
    bigdecimal.c: refine macros
    
    * ext/bigdecimal/bigdecimal.c (PUSH, SAVE): remove extra
      semicolons.
    
    * ext/bigdecimal/bigdecimal.c (GUARD_OBJ): add parentheses and
      make an expression instead of a statement.

  Modified files:
    trunk/ext/bigdecimal/bigdecimal.c
Index: ext/bigdecimal/bigdecimal.c
===================================================================
--- ext/bigdecimal/bigdecimal.c	(revision 45001)
+++ ext/bigdecimal/bigdecimal.c	(revision 45002)
@@ -72,9 +72,9 @@ static ID id_eq; https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L72
 
 /* MACRO's to guard objects from GC by keeping them in stack */
 #define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
-#define PUSH(x)  vStack[iStack++] = (VALUE)(x);
-#define SAVE(p)  PUSH(p->obj);
-#define GUARD_OBJ(p,y) {p=y;SAVE(p);}
+#define PUSH(x)  (vStack[iStack++] = (VALUE)(x))
+#define SAVE(p)  PUSH((p)->obj)
+#define GUARD_OBJ(p,y) ((p)=(y), SAVE(p))
 
 #define BASE_FIG  RMPD_COMPONENT_FIGURES
 #define BASE      RMPD_BASE

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

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