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

ruby-changes:39997

From: nobu <ko1@a...>
Date: Thu, 8 Oct 2015 10:45:02 +0900 (JST)
Subject: [ruby-changes:39997] nobu:r52078 (trunk): node.c: D_FIELD_HEADER

nobu	2015-10-08 10:44:51 +0900 (Thu, 08 Oct 2015)

  New Revision: 52078

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

  Log:
    node.c: D_FIELD_HEADER
    
    * node.c (D_FIELD_HEADER): concatenate sequential strings.

  Modified files:
    trunk/node.c
Index: node.c
===================================================================
--- node.c	(revision 52077)
+++ node.c	(revision 52078)
@@ -20,17 +20,18 @@ https://github.com/ruby/ruby/blob/trunk/node.c#L20
 #define A_INT(val) rb_str_catf(buf, "%d", (val))
 #define A_LONG(val) rb_str_catf(buf, "%ld", (val))
 #define A_LIT(lit) AR(rb_inspect(lit))
-#define A_NODE_HEADER(node) \
-    rb_str_catf(buf, "@ %s (line: %d)", ruby_node_name(nd_type(node)), nd_line(node))
-#define A_FIELD_HEADER(name) \
-    rb_str_catf(buf, "+- %s:", (name))
+#define A_NODE_HEADER(node, term) \
+    rb_str_catf(buf, "@ %s (line: %d)"term, ruby_node_name(nd_type(node)), nd_line(node))
+#define A_FIELD_HEADER(name, term) \
+    rb_str_catf(buf, "+- %s:"term, (name))
+#define D_FIELD_HEADER(name, term) (A_INDENT, A_FIELD_HEADER(name, term))
 
-#define D_NULL_NODE A_INDENT; A("(null node)"); A("\n");
-#define D_NODE_HEADER(node) A_INDENT; A_NODE_HEADER(node); A("\n");
+#define D_NULL_NODE (A_INDENT, A("(null node)\n"))
+#define D_NODE_HEADER(node) (A_INDENT, A_NODE_HEADER(node, "\n"))
 
 #define COMPOUND_FIELD(name, name2, block) \
     do { \
-	A_INDENT; A_FIELD_HEADER(comment ? (name2) : (name)); A("\n"); \
+	D_FIELD_HEADER(comment ? (name2) : (name), "\n"); \
 	rb_str_cat2(indent, next_indent); \
 	block; \
 	rb_str_resize(indent, RSTRING_LEN(indent) - 4); \
@@ -38,7 +39,7 @@ https://github.com/ruby/ruby/blob/trunk/node.c#L39
 
 #define SIMPLE_FIELD(name, name2, block) \
     do { \
-	A_INDENT; A_FIELD_HEADER(comment ? (name2) : (name)); A(" "); block; A("\n"); \
+	D_FIELD_HEADER(comment ? (name2) : (name), " "); block; A("\n"); \
     } while (0)
 
 #define F_CUSTOM1(name, ann, block) SIMPLE_FIELD(#name, #name " (" ann ")", block)

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

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