From 2a6a95a038948a7a4384f44ef99a9a454175a47c Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Date: Fri, 22 Jul 2016 17:07:34 +0900
Subject: [PATCH 8/8] Change two macros into inline functions.

ExecConsumeResult cannot have Assertion in the form of macro. So this
patch alters it into a function. ExecReturnTuple is also changed for
the reason of uniformity. This might reduce performance (it
theoretically won't be happen but I believe I saw it..)
---
 src/include/executor/executor.h | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h
index c1ef2ab..8e55b54 100644
--- a/src/include/executor/executor.h
+++ b/src/include/executor/executor.h
@@ -231,20 +231,25 @@ extern void ExecEndNode(PlanState *node);
 extern bool ExecShutdownNode(PlanState *node);
 
 /* Convenience function to set a node's result to a TupleTableSlot. */
-#define ExecReturnTuple(node, slot) \
-{ \
-	Assert(!(node)->result_ready);	\
-	(node)->result = (Node *) (slot);	\
-	(node)->result_ready = true; \
+static inline void ExecReturnTuple(PlanState *node, TupleTableSlot *slot);
+static inline void
+ExecReturnTuple(PlanState *node, TupleTableSlot *slot)
+{
+	Assert(!(node)->result_ready);
+	(node)->result = (Node *) (slot);
+	(node)->result_ready = true;
 }
 
 /* Convenience function to retrieve a node's result. */
-#define ExecConsumeResult(node) \
-( \
-    Assert((node)->result_ready), \
-    Assert((node)->result == NULL || IsA((node)->result, TupleTableSlot)), \
-    (node)->result_ready = false, \
-	(TupleTableSlot *) node->result)
+static inline TupleTableSlot *ExecConsumeResult(PlanState *node);
+static inline TupleTableSlot *
+ExecConsumeResult(PlanState *node)
+{
+    Assert(node->result_ready);
+    Assert(node->result == NULL || IsA(node->result, TupleTableSlot));
+    node->result_ready = false;
+	return (TupleTableSlot *) node->result;
+}
 
 
 /*
-- 
1.8.3.1

