pgindent run on xml.c in 8.3 branch, per request from Tom.
This commit is contained in:
parent
881a97da86
commit
2193da28b1
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.68.2.12 2010/03/01 02:21:40 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.68.2.13 2010/03/03 00:32:49 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -100,14 +100,13 @@ static void *xml_palloc(size_t size);
|
|||||||
static void *xml_repalloc(void *ptr, size_t size);
|
static void *xml_repalloc(void *ptr, size_t size);
|
||||||
static void xml_pfree(void *ptr);
|
static void xml_pfree(void *ptr);
|
||||||
static char *xml_pstrdup(const char *string);
|
static char *xml_pstrdup(const char *string);
|
||||||
|
|
||||||
#endif /* USE_LIBXMLCONTEXT */
|
#endif /* USE_LIBXMLCONTEXT */
|
||||||
|
|
||||||
static void xml_init(void);
|
static void xml_init(void);
|
||||||
static xmlChar *xml_text2xmlChar(text *in);
|
static xmlChar *xml_text2xmlChar(text *in);
|
||||||
static int parse_xml_decl(const xmlChar * str, size_t *lenp,
|
static int parse_xml_decl(const xmlChar *str, size_t *lenp,
|
||||||
xmlChar ** version, xmlChar ** encoding, int *standalone);
|
xmlChar **version, xmlChar **encoding, int *standalone);
|
||||||
static bool print_xml_decl(StringInfo buf, const xmlChar * version,
|
static bool print_xml_decl(StringInfo buf, const xmlChar *version,
|
||||||
pg_enc encoding, int standalone);
|
pg_enc encoding, int standalone);
|
||||||
static xmlDocPtr xml_parse(text *data, XmlOptionType xmloption_arg,
|
static xmlDocPtr xml_parse(text *data, XmlOptionType xmloption_arg,
|
||||||
bool preserve_whitespace, int encoding);
|
bool preserve_whitespace, int encoding);
|
||||||
@ -991,8 +990,8 @@ xml_pnstrdup(const xmlChar *str, size_t len)
|
|||||||
* Result is 0 if OK, an error code if not.
|
* Result is 0 if OK, an error code if not.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
parse_xml_decl(const xmlChar * str, size_t *lenp,
|
parse_xml_decl(const xmlChar *str, size_t *lenp,
|
||||||
xmlChar ** version, xmlChar ** encoding, int *standalone)
|
xmlChar **version, xmlChar **encoding, int *standalone)
|
||||||
{
|
{
|
||||||
const xmlChar *p;
|
const xmlChar *p;
|
||||||
const xmlChar *save_p;
|
const xmlChar *save_p;
|
||||||
@ -1149,7 +1148,7 @@ finished:
|
|||||||
* which is the default version specified in SQL:2003.
|
* which is the default version specified in SQL:2003.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
print_xml_decl(StringInfo buf, const xmlChar * version,
|
print_xml_decl(StringInfo buf, const xmlChar *version,
|
||||||
pg_enc encoding, int standalone)
|
pg_enc encoding, int standalone)
|
||||||
{
|
{
|
||||||
xml_init(); /* why is this here? */
|
xml_init(); /* why is this here? */
|
||||||
@ -1355,7 +1354,6 @@ xml_pstrdup(const char *string)
|
|||||||
{
|
{
|
||||||
return MemoryContextStrdup(LibxmlContext, string);
|
return MemoryContextStrdup(LibxmlContext, string);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* USE_LIBXMLCONTEXT */
|
#endif /* USE_LIBXMLCONTEXT */
|
||||||
|
|
||||||
|
|
||||||
@ -3411,7 +3409,7 @@ xpath(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
xpath_expr = (xmlChar *) palloc((xpath_len + 5) * sizeof(xmlChar));
|
xpath_expr = (xmlChar *) palloc((xpath_len + 5) * sizeof(xmlChar));
|
||||||
|
|
||||||
memcpy (string, datastr, len);
|
memcpy(string, datastr, len);
|
||||||
string[len] = '\0';
|
string[len] = '\0';
|
||||||
|
|
||||||
xml_init();
|
xml_init();
|
||||||
@ -3431,13 +3429,13 @@ xpath(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
if (doc == NULL || xmlDocGetRootElement(doc) == NULL)
|
if (doc == NULL || xmlDocGetRootElement(doc) == NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In case we have a fragment rather than a well-formed XML document,
|
* In case we have a fragment rather than a well-formed XML
|
||||||
* which has a single root (XML well-formedness), we try again after
|
* document, which has a single root (XML well-formedness), we try
|
||||||
* transforming the xml by stripping away the XML prolog, if any, and
|
* again after transforming the xml by stripping away the XML
|
||||||
* wrapping the remainder in a dummy element (<x>...</x>),
|
* prolog, if any, and wrapping the remainder in a dummy element
|
||||||
* and later extending the XPath expression accordingly.
|
* (<x>...</x>), and later extending the XPath expression
|
||||||
|
* accordingly.
|
||||||
*/
|
*/
|
||||||
if (len >= 5 &&
|
if (len >= 5 &&
|
||||||
xmlStrncmp((xmlChar *) datastr, (xmlChar *) "<?xml", 5) == 0)
|
xmlStrncmp((xmlChar *) datastr, (xmlChar *) "<?xml", 5) == 0)
|
||||||
@ -3468,7 +3466,10 @@ xpath(PG_FUNCTION_ARGS)
|
|||||||
xml_ereport(ERROR, ERRCODE_INVALID_XML_DOCUMENT,
|
xml_ereport(ERROR, ERRCODE_INVALID_XML_DOCUMENT,
|
||||||
"could not parse XML data");
|
"could not parse XML data");
|
||||||
|
|
||||||
/* we already know xpath_len > 0 - see above , so this test is safe */
|
/*
|
||||||
|
* we already know xpath_len > 0 - see above , so this test is
|
||||||
|
* safe
|
||||||
|
*/
|
||||||
|
|
||||||
if (*VARDATA(xpath_expr_text) == '/')
|
if (*VARDATA(xpath_expr_text) == '/')
|
||||||
{
|
{
|
||||||
@ -3489,8 +3490,8 @@ xpath(PG_FUNCTION_ARGS)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* if we didn't need to mangle the XML, we don't need to mangle the
|
* if we didn't need to mangle the XML, we don't need to mangle
|
||||||
* xpath either.
|
* the xpath either.
|
||||||
*/
|
*/
|
||||||
memcpy(xpath_expr, VARDATA(xpath_expr_text), xpath_len);
|
memcpy(xpath_expr, VARDATA(xpath_expr_text), xpath_len);
|
||||||
xpath_expr[xpath_len] = '\0';
|
xpath_expr[xpath_len] = '\0';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user