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/pg_lzcompress.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/pg_lzcompress.c')
-rw-r--r-- | src/backend/utils/adt/pg_lzcompress.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/utils/adt/pg_lzcompress.c b/src/backend/utils/adt/pg_lzcompress.c index 918f7bad7ff..c756e5707a5 100644 --- a/src/backend/utils/adt/pg_lzcompress.c +++ b/src/backend/utils/adt/pg_lzcompress.c @@ -45,7 +45,7 @@ * PGLZ_Header is defined as * * typedef struct PGLZ_Header { - * int32 varsize; + * int32 vl_len_; * int32 rawsize; * } * @@ -54,7 +54,7 @@ * The data representation is easiest explained by describing * the process of decompression. * - * If varsize == rawsize + sizeof(PGLZ_Header), then the data + * If VARSIZE(x) == rawsize + sizeof(PGLZ_Header), then the data * is stored uncompressed as plain bytes. Thus, the decompressor * simply copies rawsize bytes from the location after the * header to the destination. @@ -166,7 +166,7 @@ * * Copyright (c) 1999-2007, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.24 2007/01/20 01:08:42 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.25 2007/02/27 23:48:08 tgl Exp $ * ---------- */ #include "postgres.h" @@ -618,7 +618,7 @@ pglz_compress(const char *source, int32 slen, PGLZ_Header *dest, /* * Success - need only fill in the actual length of the compressed datum. */ - dest->varsize = result_size + sizeof(PGLZ_Header); + SET_VARSIZE(dest, result_size + sizeof(PGLZ_Header)); return true; } @@ -643,7 +643,7 @@ pglz_decompress(const PGLZ_Header *source, char *dest) int32 destsize; dp = ((const unsigned char *) source) + sizeof(PGLZ_Header); - dend = ((const unsigned char *) source) + VARATT_SIZE(source); + dend = ((const unsigned char *) source) + VARSIZE(source); bp = (unsigned char *) dest; while (dp < dend) |