diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-02-27 23:48:10 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-02-27 23:48:10 +0000 |
commit | 234a02b2a888cacc4c09363cc1411ae4eac9bb51 (patch) | |
tree | 4aadb74b5d7bbcfc3cdae9c8703eac168d6108ae /src/backend/utils/adt/formatting.c | |
parent | 0459b591fc90b197ed31923b170c658cc30758d5 (diff) | |
download | postgresql-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/formatting.c')
-rw-r--r-- | src/backend/utils/adt/formatting.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 344bf7db087..6095a1f4fdc 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- * formatting.c * - * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.128 2007/02/17 03:11:32 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.129 2007/02/27 23:48:08 tgl Exp $ * * * Portions Copyright (c) 1999-2007, PostgreSQL Global Development Group @@ -2991,7 +2991,7 @@ datetime_to_char_body(TmToChar *tmtc, text *fmt, bool is_interval) reslen = strlen(result); res = (text *) palloc(reslen + VARHDRSZ); memcpy(VARDATA(res), result, reslen); - VARATT_SIZEP(res) = reslen + VARHDRSZ; + SET_VARSIZE(res, reslen + VARHDRSZ); pfree(result); return res; @@ -4829,10 +4829,10 @@ do { \ } \ \ result_tmp = result; \ - result = (text *) palloc( len + 1 + VARHDRSZ); \ + result = (text *) palloc(len + VARHDRSZ); \ \ - strcpy( VARDATA(result), VARDATA(result_tmp)); \ - VARATT_SIZEP(result) = len + VARHDRSZ; \ + memcpy(VARDATA(result), VARDATA(result_tmp), len); \ + SET_VARSIZE(result, len + VARHDRSZ); \ pfree(result_tmp); \ } while(0) |