aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/xml.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-06-21 15:18:54 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-06-21 15:19:25 -0400
commitc7b8998ebbf310a156aa38022555a24d98fdbfb4 (patch)
treee85979fb1213a731b7b557f8a830df541f26b135 /src/backend/utils/adt/xml.c
parentf669c09989bda894d6ba01634ccb229f0687c08a (diff)
downloadpostgresql-c7b8998ebbf310a156aa38022555a24d98fdbfb4.tar.gz
postgresql-c7b8998ebbf310a156aa38022555a24d98fdbfb4.zip
Phase 2 of pgindent updates.
Change pg_bsd_indent to follow upstream rules for placement of comments to the right of code, and remove pgindent hack that caused comments following #endif to not obey the general rule. Commit e3860ffa4dd0dad0dd9eea4be9cc1412373a8c89 wasn't actually using the published version of pg_bsd_indent, but a hacked-up version that tried to minimize the amount of movement of comments to the right of code. The situation of interest is where such a comment has to be moved to the right of its default placement at column 33 because there's code there. BSD indent has always moved right in units of tab stops in such cases --- but in the previous incarnation, indent was working in 8-space tab stops, while now it knows we use 4-space tabs. So the net result is that in about half the cases, such comments are placed one tab stop left of before. This is better all around: it leaves more room on the line for comment text, and it means that in such cases the comment uniformly starts at the next 4-space tab stop after the code, rather than sometimes one and sometimes two tabs after. Also, ensure that comments following #endif are indented the same as comments following other preprocessor commands such as #else. That inconsistency turns out to have been self-inflicted damage from a poorly-thought-through post-indent "fixup" in pgindent. This patch is much less interesting than the first round of indent changes, but also bulkier, so I thought it best to separate the effects. Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
Diffstat (limited to 'src/backend/utils/adt/xml.c')
-rw-r--r--src/backend/utils/adt/xml.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index cdcd45419a4..0ed679eea69 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -65,7 +65,7 @@
#if LIBXML_VERSION >= 20704
#define HAVE_XMLSTRUCTUREDERRORCONTEXT 1
#endif
-#endif /* USE_LIBXML */
+#endif /* USE_LIBXML */
#include "access/htup_details.h"
#include "catalog/namespace.h"
@@ -133,7 +133,7 @@ static void *xml_palloc(size_t size);
static void *xml_repalloc(void *ptr, size_t size);
static void xml_pfree(void *ptr);
static char *xml_pstrdup(const char *string);
-#endif /* USE_LIBXMLCONTEXT */
+#endif /* USE_LIBXMLCONTEXT */
static xmlChar *xml_text2xmlChar(text *in);
static int parse_xml_decl(const xmlChar *str, size_t *lenp,
@@ -147,7 +147,7 @@ static int xml_xpathobjtoxmlarray(xmlXPathObjectPtr xpathobj,
ArrayBuildState *astate,
PgXmlErrorContext *xmlerrcxt);
static xmlChar *pg_xmlCharStrndup(char *str, size_t len);
-#endif /* USE_LIBXML */
+#endif /* USE_LIBXML */
static void xmldata_root_element_start(StringInfo result, const char *eltname,
const char *xmlschema, const char *targetns,
@@ -924,7 +924,7 @@ xml_is_document(xmltype *arg)
#else /* not USE_LIBXML */
NO_XML_SUPPORT();
return false;
-#endif /* not USE_LIBXML */
+#endif /* not USE_LIBXML */
}
@@ -1405,7 +1405,7 @@ xml_parse(text *data, XmlOptionType xmloption_arg, bool preserve_whitespace,
volatile xmlParserCtxtPtr ctxt = NULL;
volatile xmlDocPtr doc = NULL;
- len = VARSIZE_ANY_EXHDR(data); /* will be useful later */
+ len = VARSIZE_ANY_EXHDR(data); /* will be useful later */
string = xml_text2xmlChar(data);
utf8string = pg_do_encoding_conversion(string,
@@ -1555,7 +1555,7 @@ xml_pstrdup(const char *string)
{
return MemoryContextStrdup(LibxmlContext, string);
}
-#endif /* USE_LIBXMLCONTEXT */
+#endif /* USE_LIBXMLCONTEXT */
/*
@@ -1887,7 +1887,7 @@ is_valid_xml_namechar(pg_wchar c)
|| xmlIsCombiningQ(c)
|| xmlIsExtenderQ(c));
}
-#endif /* USE_LIBXML */
+#endif /* USE_LIBXML */
/*
@@ -1942,7 +1942,7 @@ map_sql_identifier_to_xml_name(char *ident, bool fully_escaped,
#else /* not USE_LIBXML */
NO_XML_SUPPORT();
return NULL;
-#endif /* not USE_LIBXML */
+#endif /* not USE_LIBXML */
}
@@ -2201,7 +2201,7 @@ map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings)
return result;
}
-#endif /* USE_LIBXML */
+#endif /* USE_LIBXML */
}
@@ -3942,7 +3942,7 @@ xpath_internal(text *xpath_expr_text, xmltype *data, ArrayType *namespaces,
if (xmlXPathRegisterNs(xpathctx,
(xmlChar *) ns_name,
(xmlChar *) ns_uri) != 0)
- ereport(ERROR, /* is this an internal error??? */
+ ereport(ERROR, /* is this an internal error??? */
(errmsg("could not register XML namespace with name \"%s\" and URI \"%s\"",
ns_name, ns_uri)));
}
@@ -4000,7 +4000,7 @@ xpath_internal(text *xpath_expr_text, xmltype *data, ArrayType *namespaces,
pg_xml_done(xmlerrcxt, false);
}
-#endif /* USE_LIBXML */
+#endif /* USE_LIBXML */
/*
* Evaluate XPath expression and return array of XML values.
@@ -4115,7 +4115,7 @@ xml_is_well_formed(PG_FUNCTION_ARGS)
#else
NO_XML_SUPPORT();
return 0;
-#endif /* not USE_LIBXML */
+#endif /* not USE_LIBXML */
}
Datum
@@ -4128,7 +4128,7 @@ xml_is_well_formed_document(PG_FUNCTION_ARGS)
#else
NO_XML_SUPPORT();
return 0;
-#endif /* not USE_LIBXML */
+#endif /* not USE_LIBXML */
}
Datum
@@ -4141,7 +4141,7 @@ xml_is_well_formed_content(PG_FUNCTION_ARGS)
#else
NO_XML_SUPPORT();
return 0;
-#endif /* not USE_LIBXML */
+#endif /* not USE_LIBXML */
}
/*
@@ -4221,7 +4221,7 @@ XmlTableInitOpaque(TableFuncScanState *state, int natts)
state->opaque = xtCxt;
#else
NO_XML_SUPPORT();
-#endif /* not USE_LIBXML */
+#endif /* not USE_LIBXML */
}
/*
@@ -4281,7 +4281,7 @@ XmlTableSetDocument(TableFuncScanState *state, Datum value)
xtCxt->xpathcxt = xpathcxt;
#else
NO_XML_SUPPORT();
-#endif /* not USE_LIBXML */
+#endif /* not USE_LIBXML */
}
/*
@@ -4307,7 +4307,7 @@ XmlTableSetNamespace(TableFuncScanState *state, char *name, char *uri)
"could not set XML namespace");
#else
NO_XML_SUPPORT();
-#endif /* not USE_LIBXML */
+#endif /* not USE_LIBXML */
}
/*
@@ -4336,7 +4336,7 @@ XmlTableSetRowFilter(TableFuncScanState *state, char *path)
"invalid XPath expression");
#else
NO_XML_SUPPORT();
-#endif /* not USE_LIBXML */
+#endif /* not USE_LIBXML */
}
/*
@@ -4367,7 +4367,7 @@ XmlTableSetColumnFilter(TableFuncScanState *state, char *path, int colnum)
"invalid XPath expression");
#else
NO_XML_SUPPORT();
-#endif /* not USE_LIBXML */
+#endif /* not USE_LIBXML */
}
/*
@@ -4415,7 +4415,7 @@ XmlTableFetchRow(TableFuncScanState *state)
#else
NO_XML_SUPPORT();
return false;
-#endif /* not USE_LIBXML */
+#endif /* not USE_LIBXML */
}
/*
@@ -4585,7 +4585,7 @@ XmlTableGetValue(TableFuncScanState *state, int colnum,
#else
NO_XML_SUPPORT();
return 0;
-#endif /* not USE_LIBXML */
+#endif /* not USE_LIBXML */
}
/*
@@ -4631,5 +4631,5 @@ XmlTableDestroyOpaque(TableFuncScanState *state)
#else
NO_XML_SUPPORT();
-#endif /* not USE_LIBXML */
+#endif /* not USE_LIBXML */
}