aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/xml.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-02-27 23:48:10 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-02-27 23:48:10 +0000
commit234a02b2a888cacc4c09363cc1411ae4eac9bb51 (patch)
tree4aadb74b5d7bbcfc3cdae9c8703eac168d6108ae /src/backend/utils/adt/xml.c
parent0459b591fc90b197ed31923b170c658cc30758d5 (diff)
downloadpostgresql-234a02b2a888cacc4c09363cc1411ae4eac9bb51.tar.gz
postgresql-234a02b2a888cacc4c09363cc1411ae4eac9bb51.zip
Replace direct assignments to VARATT_SIZEP(x) with SET_VARSIZE(x, len).
Get rid of VARATT_SIZE and VARATT_DATA, which were simply redundant with VARSIZE and VARDATA, and as a consequence almost no code was using the longer names. Rename the length fields of struct varlena and various derived structures to catch anyplace that was accessing them directly; and clean up various places so caught. In itself this patch doesn't change any behavior at all, but it is necessary infrastructure if we hope to play any games with the representation of varlena headers. Greg Stark and Tom Lane
Diffstat (limited to 'src/backend/utils/adt/xml.c')
-rw-r--r--src/backend/utils/adt/xml.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index f814d7f543e..c12522cfe45 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.31 2007/02/16 18:37:43 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.32 2007/02/27 23:48:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -128,7 +128,7 @@ xml_in(PG_FUNCTION_ARGS)
len = strlen(s);
vardata = palloc(len + VARHDRSZ);
- VARATT_SIZEP(vardata) = len + VARHDRSZ;
+ SET_VARSIZE(vardata, len + VARHDRSZ);
memcpy(VARDATA(vardata), s, len);
/*
@@ -225,7 +225,7 @@ xml_recv(PG_FUNCTION_ARGS)
str = pq_getmsgtext(buf, buf->len - buf->cursor, &nbytes);
result = palloc(nbytes + VARHDRSZ);
- VARATT_SIZEP(result) = nbytes + VARHDRSZ;
+ SET_VARSIZE(result, nbytes + VARHDRSZ);
memcpy(VARDATA(result), str, nbytes);
parse_xml_decl((xmlChar *) str, NULL, NULL, &encoding, NULL);
@@ -251,7 +251,7 @@ xml_recv(PG_FUNCTION_ARGS)
nbytes = strlen(newstr);
result = palloc(nbytes + VARHDRSZ);
- VARATT_SIZEP(result) = nbytes + VARHDRSZ;
+ SET_VARSIZE(result, nbytes + VARHDRSZ);
memcpy(VARDATA(result), newstr, nbytes);
}
@@ -293,7 +293,7 @@ stringinfo_to_xmltype(StringInfo buf)
len = buf->len + VARHDRSZ;
result = palloc(len);
- VARATT_SIZEP(result) = len;
+ SET_VARSIZE(result, len);
memcpy(VARDATA(result), buf->data, buf->len);
return result;
@@ -308,7 +308,7 @@ cstring_to_xmltype(const char *string)
len = strlen(string) + VARHDRSZ;
result = palloc(len);
- VARATT_SIZEP(result) = len;
+ SET_VARSIZE(result, len);
memcpy(VARDATA(result), string, len - VARHDRSZ);
return result;
@@ -324,7 +324,7 @@ xmlBuffer_to_xmltype(xmlBufferPtr buf)
len = xmlBufferLength(buf) + VARHDRSZ;
result = palloc(len);
- VARATT_SIZEP(result) = len;
+ SET_VARSIZE(result, len);
memcpy(VARDATA(result), xmlBufferContent(buf), len - VARHDRSZ);
return result;