summaryrefslogtreecommitdiff
path: root/src/backend/nodes/outfuncs.c
diff options
context:
space:
mode:
authorAndres Freund2016-04-08 21:26:36 +0000
committerAndres Freund2016-04-08 21:26:36 +0000
commitc1ddd2361f6eb071d51b856c697a4aab22f8c776 (patch)
tree82ed4e634e950bc208f192afc78dc29da32c7968 /src/backend/nodes/outfuncs.c
parent7a542700df25eaf97b794bff63606176433dcdda (diff)
Expose more out/readfuncs support functions.
Previously bcac23d exposed a subset of support functions, namely the ones Kaigai found useful. In [email protected] I mentioned that there's some functions missing to use the facility in an external project. To avoid having to add functions piecemeal, add all the functions which are used to define READ_* and WRITE_* macros; users of the extensible node functionality are likely to need these. Additionally expose outDatum(), which doesn't have it's own WRITE_ macro, as it needs information from the embedding struct. Discussion: [email protected]
Diffstat (limited to 'src/backend/nodes/outfuncs.c')
-rw-r--r--src/backend/nodes/outfuncs.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index f783a49ebac..5ac74460f28 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -89,7 +89,7 @@
/* Write a Node field */
#define WRITE_NODE_FIELD(fldname) \
(appendStringInfo(str, " :" CppAsString(fldname) " "), \
- _outNode(str, node->fldname))
+ outNode(str, node->fldname))
/* Write a bitmapset field */
#define WRITE_BITMAPSET_FIELD(fldname) \
@@ -99,8 +99,6 @@
#define booltostr(x) ((x) ? "true" : "false")
-static void _outNode(StringInfo str, const void *obj);
-
/*
* _outToken
@@ -169,7 +167,7 @@ _outList(StringInfo str, const List *node)
*/
if (IsA(node, List))
{
- _outNode(str, lfirst(lc));
+ outNode(str, lfirst(lc));
if (lnext(lc))
appendStringInfoChar(str, ' ');
}
@@ -214,8 +212,8 @@ outBitmapset(StringInfo str, const Bitmapset *bms)
/*
* Print the value of a Datum given its type.
*/
-static void
-_outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
+void
+outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
{
Size length,
i;
@@ -1009,7 +1007,7 @@ _outConst(StringInfo str, const Const *node)
if (node->constisnull)
appendStringInfoString(str, "<>");
else
- _outDatum(str, node->constvalue, node->constlen, node->constbyval);
+ outDatum(str, node->constvalue, node->constlen, node->constbyval);
}
static void
@@ -3219,11 +3217,11 @@ _outConstraint(StringInfo str, const Constraint *node)
/*
- * _outNode -
+ * outNode -
* converts a Node into ascii string and append it to 'str'
*/
-static void
-_outNode(StringInfo str, const void *obj)
+void
+outNode(StringInfo str, const void *obj)
{
if (obj == NULL)
appendStringInfoString(str, "<>");
@@ -3801,7 +3799,7 @@ _outNode(StringInfo str, const void *obj)
/*
* This should be an ERROR, but it's too useful to be able to
- * dump structures that _outNode only understands part of.
+ * dump structures that outNode only understands part of.
*/
elog(WARNING, "could not dump unrecognized node type: %d",
(int) nodeTag(obj));
@@ -3822,6 +3820,6 @@ nodeToString(const void *obj)
/* see stringinfo.h for an explanation of this maneuver */
initStringInfo(&str);
- _outNode(&str, obj);
+ outNode(&str, obj);
return str.data;
}