aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/pg_lzcompress.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2005-05-25 21:40:43 +0000
committerBruce Momjian <bruce@momjian.us>2005-05-25 21:40:43 +0000
commitb492c3acccb3f8c97559ddfc2a25f25953a026d2 (patch)
treea9c42aa2bd86a88a849ffaa005766ffe3dee762a /src/backend/utils/adt/pg_lzcompress.c
parent13b729ca5267b58005f1ca9c873a86c2b0db3591 (diff)
downloadpostgresql-b492c3acccb3f8c97559ddfc2a25f25953a026d2.tar.gz
postgresql-b492c3acccb3f8c97559ddfc2a25f25953a026d2.zip
Add parentheses to macros when args are used in computations. Without
them, the executation behavior could be unexpected.
Diffstat (limited to 'src/backend/utils/adt/pg_lzcompress.c')
-rw-r--r--src/backend/utils/adt/pg_lzcompress.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/backend/utils/adt/pg_lzcompress.c b/src/backend/utils/adt/pg_lzcompress.c
index a4ca8b0bbf2..d7c34b6a929 100644
--- a/src/backend/utils/adt/pg_lzcompress.c
+++ b/src/backend/utils/adt/pg_lzcompress.c
@@ -1,7 +1,7 @@
/* ----------
* pg_lzcompress.c -
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.18 2003/11/29 19:51:59 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.19 2005/05/25 21:40:41 momjian Exp $
*
* This is an implementation of LZ compression for PostgreSQL.
* It uses a simple history table and generates 2-3 byte tags
@@ -328,8 +328,8 @@ do { \
do { \
if ((__ctrl & 0xff) == 0) \
{ \
- *__ctrlp = __ctrlb; \
- __ctrlp = __buf++; \
+ *(__ctrlp) = __ctrlb; \
+ __ctrlp = (__buf)++; \
__ctrlb = 0; \
__ctrl = 1; \
} \
@@ -346,7 +346,7 @@ do { \
#define pglz_out_literal(_ctrlp,_ctrlb,_ctrl,_buf,_byte) \
do { \
pglz_out_ctrl(_ctrlp,_ctrlb,_ctrl,_buf); \
- *_buf++ = (unsigned char)(_byte); \
+ *(_buf)++ = (unsigned char)(_byte); \
_ctrl <<= 1; \
} while (0)
@@ -366,14 +366,14 @@ do { \
_ctrl <<= 1; \
if (_len > 17) \
{ \
- _buf[0] = (unsigned char)((((_off) & 0xf00) >> 4) | 0x0f); \
- _buf[1] = (unsigned char)((_off & 0xff)); \
- _buf[2] = (unsigned char)((_len) - 18); \
- _buf += 3; \
+ (_buf)[0] = (unsigned char)((((_off) & 0xf00) >> 4) | 0x0f); \
+ (_buf)[1] = (unsigned char)(((_off) & 0xff)); \
+ (_buf)[2] = (unsigned char)((_len) - 18); \
+ (_buf) += 3; \
} else { \
- _buf[0] = (unsigned char)((((_off) & 0xf00) >> 4) | (_len - 3)); \
- _buf[1] = (unsigned char)((_off) & 0xff); \
- _buf += 2; \
+ (_buf)[0] = (unsigned char)((((_off) & 0xf00) >> 4) | ((_len) - 3)); \
+ (_buf)[1] = (unsigned char)((_off) & 0xff); \
+ (_buf) += 2; \
} \
} while (0)