diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/access/hash/hashfunc.c | 20 | ||||
-rw-r--r-- | src/backend/regex/regcomp.c | 4 | ||||
-rw-r--r-- | src/backend/utils/adt/formatting.c | 22 | ||||
-rw-r--r-- | src/backend/utils/adt/pg_lzcompress.c | 22 | ||||
-rw-r--r-- | src/backend/utils/sort/tuplesort.c | 4 | ||||
-rw-r--r-- | src/bin/pg_dump/pg_backup_archiver.h | 8 | ||||
-rw-r--r-- | src/include/access/attnum.h | 4 | ||||
-rw-r--r-- | src/include/c.h | 6 | ||||
-rw-r--r-- | src/include/catalog/pg_trigger.h | 22 | ||||
-rw-r--r-- | src/include/libpq/crypt.h | 4 | ||||
-rw-r--r-- | src/include/port.h | 6 | ||||
-rw-r--r-- | src/include/regex/regguts.h | 4 | ||||
-rw-r--r-- | src/include/storage/itempos.h | 4 | ||||
-rw-r--r-- | src/include/utils/pg_lzcompress.h | 10 | ||||
-rw-r--r-- | src/include/utils/timestamp.h | 6 | ||||
-rw-r--r-- | src/interfaces/ecpg/pgtypeslib/dt.h | 16 | ||||
-rw-r--r-- | src/port/crypt.c | 8 | ||||
-rw-r--r-- | src/port/qsort.c | 6 |
18 files changed, 88 insertions, 88 deletions
diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c index 46033b19e93..05ca3bcdb12 100644 --- a/src/backend/access/hash/hashfunc.c +++ b/src/backend/access/hash/hashfunc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/hash/hashfunc.c,v 1.43 2005/03/29 00:16:50 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/hash/hashfunc.c,v 1.44 2005/05/25 21:40:40 momjian Exp $ * * NOTES * These functions are stored in pg_amproc. For each operator class @@ -192,15 +192,15 @@ hashvarlena(PG_FUNCTION_ARGS) */ #define mix(a,b,c) \ { \ - a -= b; a -= c; a ^= (c>>13); \ - b -= c; b -= a; b ^= (a<<8); \ - c -= a; c -= b; c ^= (b>>13); \ - a -= b; a -= c; a ^= (c>>12); \ - b -= c; b -= a; b ^= (a<<16); \ - c -= a; c -= b; c ^= (b>>5); \ - a -= b; a -= c; a ^= (c>>3); \ - b -= c; b -= a; b ^= (a<<10); \ - c -= a; c -= b; c ^= (b>>15); \ + a -= b; a -= c; a ^= ((c)>>13); \ + b -= c; b -= a; b ^= ((a)<<8); \ + c -= a; c -= b; c ^= ((b)>>13); \ + a -= b; a -= c; a ^= ((c)>>12); \ + b -= c; b -= a; b ^= ((a)<<16); \ + c -= a; c -= b; c ^= ((b)>>5); \ + a -= b; a -= c; a ^= ((c)>>3); \ + b -= c; b -= a; b ^= ((a)<<10); \ + c -= a; c -= b; c ^= ((b)>>15); \ } /* diff --git a/src/backend/regex/regcomp.c b/src/backend/regex/regcomp.c index cdf2683bc79..8ba34512458 100644 --- a/src/backend/regex/regcomp.c +++ b/src/backend/regex/regcomp.c @@ -28,7 +28,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $PostgreSQL: pgsql/src/backend/regex/regcomp.c,v 1.42 2004/11/24 22:56:54 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/regex/regcomp.c,v 1.43 2005/05/25 21:40:40 momjian Exp $ * */ @@ -232,7 +232,7 @@ struct vars struct cvec *cv; /* interface cvec */ struct cvec *cv2; /* utility cvec */ struct cvec *mcces; /* collating-element information */ -#define ISCELEADER(v,c) (v->mcces != NULL && haschr(v->mcces, (c))) +#define ISCELEADER(v,c) ((v)->mcces != NULL && haschr((v)->mcces, (c))) struct state *mccepbegin; /* in nfa, start of MCCE prototypes */ struct state *mccepend; /* in nfa, end of MCCE prototypes */ struct subre *lacons; /* lookahead-constraint vector */ diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 8645fceecf7..68a73bbb6fc 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.86 2005/03/26 00:41:31 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.87 2005/05/25 21:40:40 momjian Exp $ * * * Portions Copyright (c) 1999-2005, PostgreSQL Global Development Group @@ -171,7 +171,7 @@ static char *months_full[] = { * AC / DC * ---------- */ -#define YEAR_ABS(_y) (_y <= 0 ? -(_y -1) : _y) +#define YEAR_ABS(_y) ((_y) <= 0 ? -((_y) - 1) : _y) #define BC_STR_ORIG " BC" #define A_D_STR "A.D." @@ -280,15 +280,15 @@ typedef struct */ #define NUM_F_DECIMAL (1 << 1) #define NUM_F_LDECIMAL (1 << 2) -#define NUM_F_ZERO (1 << 3) +#define NUM_F_ZERO (1 << 3) #define NUM_F_BLANK (1 << 4) #define NUM_F_FILLMODE (1 << 5) #define NUM_F_LSIGN (1 << 6) #define NUM_F_BRACKET (1 << 7) #define NUM_F_MINUS (1 << 8) -#define NUM_F_PLUS (1 << 9) +#define NUM_F_PLUS (1 << 9) #define NUM_F_ROMAN (1 << 10) -#define NUM_F_MULTI (1 << 11) +#define NUM_F_MULTI (1 << 11) #define NUM_F_PLUS_POST (1 << 12) #define NUM_F_MINUS_POST (1 << 13) @@ -457,13 +457,13 @@ static int dch_date(int arg, char *inout, int suf, int flag, FormatNode *node, v * Suffix tests * ---------- */ -#define S_THth(_s) (((_s & DCH_S_TH) || (_s & DCH_S_th)) ? 1 : 0) -#define S_TH(_s) ((_s & DCH_S_TH) ? 1 : 0) -#define S_th(_s) ((_s & DCH_S_th) ? 1 : 0) -#define S_TH_TYPE(_s) ((_s & DCH_S_TH) ? TH_UPPER : TH_LOWER) +#define S_THth(_s) ((((_s) & DCH_S_TH) || ((_s) & DCH_S_th)) ? 1 : 0) +#define S_TH(_s) (((_s) & DCH_S_TH) ? 1 : 0) +#define S_th(_s) (((_s) & DCH_S_th) ? 1 : 0) +#define S_TH_TYPE(_s) (((_s) & DCH_S_TH) ? TH_UPPER : TH_LOWER) -#define S_FM(_s) ((_s & DCH_S_FM) ? 1 : 0) -#define S_SP(_s) ((_s & DCH_S_SP) ? 1 : 0) +#define S_FM(_s) (((_s) & DCH_S_FM) ? 1 : 0) +#define S_SP(_s) (((_s) & DCH_S_SP) ? 1 : 0) /* ---------- * Suffixes definition for DATE-TIME TO/FROM CHAR 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) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index deedd53bd3b..12704a09c44 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -78,7 +78,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/sort/tuplesort.c,v 1.48 2005/05/06 17:24:54 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/sort/tuplesort.c,v 1.49 2005/05/25 21:40:41 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1564,7 +1564,7 @@ tuplesort_restorepos(Tuplesortstate *state) */ #define HEAPCOMPARE(tup1,index1,tup2,index2) \ - (checkIndex && (index1 != index2) ? index1 - index2 : \ + (checkIndex && (index1 != index2) ? (index1) - (index2) : \ COMPARETUP(state, tup1, tup2)) /* diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h index c08665c2e5d..8e84503b36d 100644 --- a/src/bin/pg_dump/pg_backup_archiver.h +++ b/src/bin/pg_dump/pg_backup_archiver.h @@ -17,7 +17,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.63 2005/01/25 22:44:31 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.64 2005/05/25 21:40:41 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -43,11 +43,11 @@ #ifdef HAVE_LIBZ #include <zlib.h> #define GZCLOSE(fh) gzclose(fh) -#define GZWRITE(p, s, n, fh) gzwrite(fh, p, n * s) -#define GZREAD(p, s, n, fh) gzread(fh, p, n * s) +#define GZWRITE(p, s, n, fh) gzwrite(fh, p, (n) * (s)) +#define GZREAD(p, s, n, fh) gzread(fh, p, (n) * (s)) #else #define GZCLOSE(fh) fclose(fh) -#define GZWRITE(p, s, n, fh) (fwrite(p, s, n, fh) * s) +#define GZWRITE(p, s, n, fh) (fwrite(p, s, n, fh) * (s)) #define GZREAD(p, s, n, fh) fread(p, s, n, fh) #define Z_DEFAULT_COMPRESSION -1 diff --git a/src/include/access/attnum.h b/src/include/access/attnum.h index 37a500f77f9..7a4822e63f7 100644 --- a/src/include/access/attnum.h +++ b/src/include/access/attnum.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/attnum.h,v 1.20 2004/12/31 22:03:21 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/access/attnum.h,v 1.21 2005/05/25 21:40:42 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -58,6 +58,6 @@ typedef int16 AttrNumber; * Returns the attribute number for an attribute offset. */ #define AttrOffsetGetAttrNumber(attributeOffset) \ - ((AttrNumber) (1 + attributeOffset)) + ((AttrNumber) (1 + (attributeOffset))) #endif /* ATTNUM_H */ diff --git a/src/include/c.h b/src/include/c.h index e57c8e9daa4..6318c5573dd 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/c.h,v 1.183 2005/05/11 01:26:02 neilc Exp $ + * $PostgreSQL: pgsql/src/include/c.h,v 1.184 2005/05/25 21:40:41 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -535,7 +535,7 @@ typedef NameData *Name; * endof * Address of the element one past the last in an array. */ -#define endof(array) (&array[lengthof(array)]) +#define endof(array) (&(array)[lengthof(array)]) /* ---------------- * Alignment macros: align a length or address appropriately for a given type. @@ -549,7 +549,7 @@ typedef NameData *Name; */ #define TYPEALIGN(ALIGNVAL,LEN) \ - (((long) (LEN) + (ALIGNVAL-1)) & ~((long) (ALIGNVAL-1))) + (((long) (LEN) + ((ALIGNVAL) - 1)) & ~((long) ((ALIGNVAL) - 1))) #define SHORTALIGN(LEN) TYPEALIGN(ALIGNOF_SHORT, (LEN)) #define INTALIGN(LEN) TYPEALIGN(ALIGNOF_INT, (LEN)) diff --git a/src/include/catalog/pg_trigger.h b/src/include/catalog/pg_trigger.h index cf3b51b375f..43e514e4142 100644 --- a/src/include/catalog/pg_trigger.h +++ b/src/include/catalog/pg_trigger.h @@ -81,18 +81,18 @@ typedef FormData_pg_trigger *Form_pg_trigger; #define TRIGGER_TYPE_DELETE (1 << 3) #define TRIGGER_TYPE_UPDATE (1 << 4) -#define TRIGGER_CLEAR_TYPE(type) (type = 0) +#define TRIGGER_CLEAR_TYPE(type) ((type) = 0) -#define TRIGGER_SETT_ROW(type) (type |= TRIGGER_TYPE_ROW) -#define TRIGGER_SETT_BEFORE(type) (type |= TRIGGER_TYPE_BEFORE) -#define TRIGGER_SETT_INSERT(type) (type |= TRIGGER_TYPE_INSERT) -#define TRIGGER_SETT_DELETE(type) (type |= TRIGGER_TYPE_DELETE) -#define TRIGGER_SETT_UPDATE(type) (type |= TRIGGER_TYPE_UPDATE) +#define TRIGGER_SETT_ROW(type) ((type) |= TRIGGER_TYPE_ROW) +#define TRIGGER_SETT_BEFORE(type) ((type) |= TRIGGER_TYPE_BEFORE) +#define TRIGGER_SETT_INSERT(type) ((type) |= TRIGGER_TYPE_INSERT) +#define TRIGGER_SETT_DELETE(type) ((type) |= TRIGGER_TYPE_DELETE) +#define TRIGGER_SETT_UPDATE(type) ((type) |= TRIGGER_TYPE_UPDATE) -#define TRIGGER_FOR_ROW(type) (type & TRIGGER_TYPE_ROW) -#define TRIGGER_FOR_BEFORE(type) (type & TRIGGER_TYPE_BEFORE) -#define TRIGGER_FOR_INSERT(type) (type & TRIGGER_TYPE_INSERT) -#define TRIGGER_FOR_DELETE(type) (type & TRIGGER_TYPE_DELETE) -#define TRIGGER_FOR_UPDATE(type) (type & TRIGGER_TYPE_UPDATE) +#define TRIGGER_FOR_ROW(type) ((type) & TRIGGER_TYPE_ROW) +#define TRIGGER_FOR_BEFORE(type) ((type) & TRIGGER_TYPE_BEFORE) +#define TRIGGER_FOR_INSERT(type) ((type) & TRIGGER_TYPE_INSERT) +#define TRIGGER_FOR_DELETE(type) ((type) & TRIGGER_TYPE_DELETE) +#define TRIGGER_FOR_UPDATE(type) ((type) & TRIGGER_TYPE_UPDATE) #endif /* PG_TRIGGER_H */ diff --git a/src/include/libpq/crypt.h b/src/include/libpq/crypt.h index dcb812247a5..440b2e034c7 100644 --- a/src/include/libpq/crypt.h +++ b/src/include/libpq/crypt.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/libpq/crypt.h,v 1.30 2004/12/31 22:03:32 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/libpq/crypt.h,v 1.31 2005/05/25 21:40:42 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #define MD5_PASSWD_LEN 35 -#define isMD5(passwd) (strncmp((passwd),"md5",3) == 0 && \ +#define isMD5(passwd) (strncmp(passwd, "md5", 3) == 0 && \ strlen(passwd) == MD5_PASSWD_LEN) diff --git a/src/include/port.h b/src/include/port.h index 4869ee66265..f3120932c9b 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/port.h,v 1.74 2005/03/25 00:34:24 tgl Exp $ + * $PostgreSQL: pgsql/src/include/port.h,v 1.75 2005/05/25 21:40:41 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -255,8 +255,8 @@ extern off_t ftello(FILE *stream); #endif #ifndef HAVE_FSEEKO -#define fseeko(a, b, c) fseek((a), (b), (c)) -#define ftello(a) ftell((a)) +#define fseeko(a, b, c) fseek(a, b, c) +#define ftello(a) ftell(a) #endif #ifndef HAVE_GETOPT diff --git a/src/include/regex/regguts.h b/src/include/regex/regguts.h index b2e042d7195..1fb1e748a28 100644 --- a/src/include/regex/regguts.h +++ b/src/include/regex/regguts.h @@ -27,7 +27,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $PostgreSQL: pgsql/src/include/regex/regguts.h,v 1.3 2003/11/29 22:41:10 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/regex/regguts.h,v 1.4 2005/05/25 21:40:42 momjian Exp $ */ @@ -63,7 +63,7 @@ /* function-pointer declarator */ #ifndef FUNCPTR -#define FUNCPTR(name, args) (*name) args +#define FUNCPTR(name, args) (*(name)) args #endif /* memory allocation */ diff --git a/src/include/storage/itempos.h b/src/include/storage/itempos.h index ded1c3837e6..fe875535c12 100644 --- a/src/include/storage/itempos.h +++ b/src/include/storage/itempos.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/itempos.h,v 1.20 2004/12/31 22:03:42 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/storage/itempos.h,v 1.21 2005/05/25 21:40:42 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -32,7 +32,7 @@ typedef ItemSubpositionData *ItemSubposition; * struct objpos *OBJP; * unsigned LEN; */ -#define PNOBREAK(OBJP, LEN) ((OBJP)->op_len >= LEN) +#define PNOBREAK(OBJP, LEN) ((OBJP)->op_len >= (LEN)) /* * PSKIP(OBJP, LEN) diff --git a/src/include/utils/pg_lzcompress.h b/src/include/utils/pg_lzcompress.h index d6422079cee..027025f939d 100644 --- a/src/include/utils/pg_lzcompress.h +++ b/src/include/utils/pg_lzcompress.h @@ -1,7 +1,7 @@ /* ---------- * pg_lzcompress.h - * - * $PostgreSQL: pgsql/src/include/utils/pg_lzcompress.h,v 1.10 2003/11/29 19:52:08 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/utils/pg_lzcompress.h,v 1.11 2005/05/25 21:40:42 momjian Exp $ * * Definitions for the builtin LZ compressor * ---------- @@ -46,7 +46,7 @@ typedef struct PGLZ_Header * in the entry. * ---------- */ -#define PGLZ_RAW_SIZE(_lzdata) (_lzdata->rawsize) +#define PGLZ_RAW_SIZE(_lzdata) ((_lzdata)->rawsize) /* ---------- * PGLZ_IS_COMPRESSED - @@ -55,8 +55,8 @@ typedef struct PGLZ_Header * uncompressed data. * ---------- */ -#define PGLZ_IS_COMPRESSED(_lzdata) (_lzdata->varsize != \ - _lzdata->rawsize + \ +#define PGLZ_IS_COMPRESSED(_lzdata) ((_lzdata)->varsize != \ +e (_lzdata)->rawsize + e \ sizeof(PGLZ_Header)) /* ---------- @@ -180,7 +180,7 @@ extern PGLZ_Strategy *PGLZ_strategy_never; * Initialize a decomp state from a compressed input. * ---------- */ -#define pglz_decomp_init(_ds,_lz) do { \ +#define pglz_decomp_init(_ds,_lz) do { \ (_ds)->cp_in = ((unsigned char *)(_lz)) \ + sizeof(PGLZ_Header); \ (_ds)->cp_end = (_ds)->cp_in + (_lz)->varsize \ diff --git a/src/include/utils/timestamp.h b/src/include/utils/timestamp.h index 743d58ac969..cfd5e1458c5 100644 --- a/src/include/utils/timestamp.h +++ b/src/include/utils/timestamp.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/timestamp.h,v 1.42 2005/05/23 21:54:02 momjian Exp $ + * $PostgreSQL: pgsql/src/include/utils/timestamp.h,v 1.43 2005/05/25 21:40:42 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -123,10 +123,10 @@ typedef struct #endif /* HAVE_INT64_TIMESTAMP */ -#define TIMESTAMP_NOBEGIN(j) do {j = DT_NOBEGIN;} while (0) +#define TIMESTAMP_NOBEGIN(j) do {(j) = DT_NOBEGIN;} while (0) #define TIMESTAMP_IS_NOBEGIN(j) ((j) == DT_NOBEGIN) -#define TIMESTAMP_NOEND(j) do {j = DT_NOEND;} while (0) +#define TIMESTAMP_NOEND(j) do {(j) = DT_NOEND;} while (0) #define TIMESTAMP_IS_NOEND(j) ((j) == DT_NOEND) #define TIMESTAMP_NOT_FINITE(j) (TIMESTAMP_IS_NOBEGIN(j) || TIMESTAMP_IS_NOEND(j)) diff --git a/src/interfaces/ecpg/pgtypeslib/dt.h b/src/interfaces/ecpg/pgtypeslib/dt.h index 53108a85bf4..c85a7cce683 100644 --- a/src/interfaces/ecpg/pgtypeslib/dt.h +++ b/src/interfaces/ecpg/pgtypeslib/dt.h @@ -193,8 +193,8 @@ typedef struct */ #define FMODULO(t,q,u) \ do { \ - q = ((t < 0) ? ceil(t / u): floor(t / u)); \ - if (q != 0) t -= rint(q * u); \ + (q) = (((t) < 0) ? ceil((t) / (u)): floor((t) / (u))); \ + if ((q) != 0) (t) -= rint((q) * (u)); \ } while(0) /* TMODULO() @@ -205,14 +205,14 @@ do { \ #ifdef HAVE_INT64_TIMESTAMP #define TMODULO(t,q,u) \ do { \ - q = (t / u); \ - if (q != 0) t -= (q * u); \ + (q) = ((t) / (u)); \ + if ((q) != 0) (t) -= ((q) * (u)); \ } while(0) #else #define TMODULO(t,q,u) \ do { \ - q = ((t < 0) ? ceil(t / u): floor(t / u)); \ - if (q != 0) t -= rint(q * u); \ + (q) = (((t) < 0) ? ceil((t) / (u)): floor((t) / (u))); \ + if ((q) != 0) (t) -= rint((q) * (u)); \ } while(0) #endif @@ -277,8 +277,8 @@ do { \ #endif #endif /* HAVE_INT64_TIMESTAMP */ -#define TIMESTAMP_NOBEGIN(j) do {j = DT_NOBEGIN;} while (0) -#define TIMESTAMP_NOEND(j) do {j = DT_NOEND;} while (0) +#define TIMESTAMP_NOBEGIN(j) do {(j) = DT_NOBEGIN;} while (0) +#define TIMESTAMP_NOEND(j) do {(j) = DT_NOEND;} while (0) #define TIMESTAMP_IS_NOBEGIN(j) ((j) == DT_NOBEGIN) #define TIMESTAMP_IS_NOEND(j) ((j) == DT_NOEND) #define TIMESTAMP_NOT_FINITE(j) (TIMESTAMP_IS_NOBEGIN(j) || TIMESTAMP_IS_NOEND(j)) diff --git a/src/port/crypt.c b/src/port/crypt.c index 7d0f14a6d10..2c71be98a94 100644 --- a/src/port/crypt.c +++ b/src/port/crypt.c @@ -740,7 +740,7 @@ int num_iter; { #define SPTAB(t, i) \ - (*(int32_t *)((unsigned char *)t + i*(sizeof(int32_t)/4))) + (*(int32_t *)((unsigned char *)(t) + (i)*(sizeof(int32_t)/4))) #if defined(gould) /* use this if B.b[i] is evaluated just once ... */ #define DOXOR(x,y,i) x^=SPTAB(SPE[0][i],B.b[i]); y^=SPTAB(SPE[1][i],B.b[i]); @@ -755,9 +755,9 @@ int num_iter; #endif #define CRUNCH(p0, p1, q0, q1) \ - k = (q0 ^ q1) & SALT; \ - B.b32.i0 = k ^ q0 ^ kp->b32.i0; \ - B.b32.i1 = k ^ q1 ^ kp->b32.i1; \ + k = ((q0) ^ (q1)) & SALT; \ + B.b32.i0 = k ^ (q0) ^ kp->b32.i0; \ + B.b32.i1 = k ^ (q1) ^ kp->b32.i1; \ kp = (C_block *)((char *)kp+ks_inc); \ \ DOXOR(p0, p1, 0); \ diff --git a/src/port/qsort.c b/src/port/qsort.c index 2fb5149a8b3..08b53890442 100644 --- a/src/port/qsort.c +++ b/src/port/qsort.c @@ -3,7 +3,7 @@ * Add do ... while() macro fix * Remove __inline, _DIAGASSERTs, __P * - * $PostgreSQL: pgsql/src/port/qsort.c,v 1.5 2004/10/05 00:12:49 neilc Exp $ + * $PostgreSQL: pgsql/src/port/qsort.c,v 1.6 2005/05/25 21:40:43 momjian Exp $ */ /* $NetBSD: qsort.c,v 1.13 2003/08/07 16:43:42 agc Exp $ */ @@ -63,8 +63,8 @@ do { \ } while (--i > 0); \ } while (0) -#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \ - es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; +#define SWAPINIT(a, es) swaptype = ((char *)(a) - (char *)0) % sizeof(long) || \ + (es) % sizeof(long) ? 2 : (es) == sizeof(long)? 0 : 1; static void swapfunc(a, b, n, swaptype) |