Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a4c75ec

Browse files
author
Neil Conway
committed
Fix a few macro definitions to ensure that unary minus is enclosed in
parentheses. This avoids possible operator precedence problems, and is consistent with most of the macro definitions in the tree.
1 parent b98b75e commit a4c75ec

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

src/backend/utils/adt/formatting.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -----------------------------------------------------------------------
22
* formatting.c
33
*
4-
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.93 2005/07/23 14:25:33 momjian Exp $
4+
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.94 2005/07/27 12:44:09 neilc Exp $
55
*
66
*
77
* Portions Copyright (c) 1999-2005, PostgreSQL Global Development Group
@@ -292,7 +292,7 @@ typedef struct
292292
#define NUM_F_PLUS_POST (1 << 12)
293293
#define NUM_F_MINUS_POST (1 << 13)
294294

295-
#define NUM_LSIGN_PRE -1
295+
#define NUM_LSIGN_PRE (-1)
296296
#define NUM_LSIGN_POST 1
297297
#define NUM_LSIGN_NONE 0
298298

@@ -384,27 +384,27 @@ typedef struct
384384
yysz; /* is it YY or YYYY ? */
385385
} TmFromChar;
386386

387-
#define ZERO_tmfc( _X ) memset(_X, 0, sizeof(TmFromChar))
387+
#define ZERO_tmfc(_X) memset(_X, 0, sizeof(TmFromChar))
388388

389389
/* ----------
390390
* Debug
391391
* ----------
392392
*/
393393
#ifdef DEBUG_TO_FROM_CHAR
394-
#define DEBUG_TMFC( _X ) \
394+
#define DEBUG_TMFC(_X) \
395395
elog(DEBUG_elog_output, "TMFC:\nhh %d\nam %d\npm %d\nmi %d\nss %d\nssss %d\nd %d\ndd %d\nddd %d\nmm %d\nms: %d\nyear %d\nbc %d\niw %d\nww %d\nw %d\ncc %d\nq %d\nj %d\nus: %d\nyysz: %d", \
396396
(_X)->hh, (_X)->am, (_X)->pm, (_X)->mi, (_X)->ss, \
397397
(_X)->ssss, (_X)->d, (_X)->dd, (_X)->ddd, (_X)->mm, (_X)->ms, \
398398
(_X)->year, (_X)->bc, (_X)->iw, (_X)->ww, (_X)->w, \
399399
(_X)->cc, (_X)->q, (_X)->j, (_X)->us, (_X)->yysz);
400-
#define DEBUG_TM( _X ) \
400+
#define DEBUG_TM(_X) \
401401
elog(DEBUG_elog_output, "TM:\nsec %d\nyear %d\nmin %d\nwday %d\nhour %d\nyday %d\nmday %d\nnisdst %d\nmon %d\n",\
402402
(_X)->tm_sec, (_X)->tm_year,\
403403
(_X)->tm_min, (_X)->tm_wday, (_X)->tm_hour, (_X)->tm_yday,\
404404
(_X)->tm_mday, (_X)->tm_isdst, (_X)->tm_mon)
405405
#else
406-
#define DEBUG_TMFC( _X )
407-
#define DEBUG_TM( _X )
406+
#define DEBUG_TMFC(_X)
407+
#define DEBUG_TM(_X)
408408
#endif
409409

410410
/* ----------
@@ -422,14 +422,14 @@ typedef struct TmToChar
422422
#define tmtcTzn(_X) ((_X)->tzn)
423423
#define tmtcFsec(_X) ((_X)->fsec)
424424

425-
#define ZERO_tm( _X ) \
425+
#define ZERO_tm(_X) \
426426
do { \
427427
(_X)->tm_sec = (_X)->tm_year = (_X)->tm_min = (_X)->tm_wday = \
428428
(_X)->tm_hour = (_X)->tm_yday = (_X)->tm_isdst = 0; \
429429
(_X)->tm_mday = (_X)->tm_mon = 1; \
430430
} while(0)
431431

432-
#define ZERO_tmtc( _X ) \
432+
#define ZERO_tmtc(_X) \
433433
do { \
434434
ZERO_tm( tmtcTm(_X) ); \
435435
tmtcFsec(_X) = 0; \

src/bin/pg_dump/pg_backup_archiver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
*
1919
* IDENTIFICATION
20-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.65 2005/06/21 20:45:44 tgl Exp $
20+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.66 2005/07/27 12:44:10 neilc Exp $
2121
*
2222
*-------------------------------------------------------------------------
2323
*/
@@ -49,7 +49,7 @@
4949
#define GZCLOSE(fh) fclose(fh)
5050
#define GZWRITE(p, s, n, fh) (fwrite(p, s, n, fh) * (s))
5151
#define GZREAD(p, s, n, fh) fread(p, s, n, fh)
52-
#define Z_DEFAULT_COMPRESSION -1
52+
#define Z_DEFAULT_COMPRESSION (-1)
5353

5454
typedef struct _z_stream
5555
{

src/include/getaddrinfo.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* Copyright (c) 2003-2005, PostgreSQL Global Development Group
1717
*
18-
* $PostgreSQL: pgsql/src/include/getaddrinfo.h,v 1.14 2005/01/01 20:44:26 tgl Exp $
18+
* $PostgreSQL: pgsql/src/include/getaddrinfo.h,v 1.15 2005/07/27 12:44:10 neilc Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -31,15 +31,15 @@
3131
/* Various macros that ought to be in <netdb.h>, but might not be */
3232

3333
#ifndef EAI_FAIL
34-
#define EAI_BADFLAGS -1
35-
#define EAI_NONAME -2
36-
#define EAI_AGAIN -3
37-
#define EAI_FAIL -4
38-
#define EAI_FAMILY -6
39-
#define EAI_SOCKTYPE -7
40-
#define EAI_SERVICE -8
41-
#define EAI_MEMORY -10
42-
#define EAI_SYSTEM -11
34+
#define EAI_BADFLAGS (-1)
35+
#define EAI_NONAME (-2)
36+
#define EAI_AGAIN (-3)
37+
#define EAI_FAIL (-4)
38+
#define EAI_FAMILY (-6)
39+
#define EAI_SOCKTYPE (-7)
40+
#define EAI_SERVICE (-8)
41+
#define EAI_MEMORY (-10)
42+
#define EAI_SYSTEM (-11)
4343
#endif
4444

4545
#ifndef AI_PASSIVE

src/include/rusagestub.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/rusagestub.h,v 1.15 2004/12/31 22:03:19 pgsql Exp $
10+
* $PostgreSQL: pgsql/src/include/rusagestub.h,v 1.16 2005/07/27 12:44:10 neilc Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -21,7 +21,7 @@
2121
#include <limits.h> /* for CLK_TCK */
2222

2323
#define RUSAGE_SELF 0
24-
#define RUSAGE_CHILDREN -1
24+
#define RUSAGE_CHILDREN (-1)
2525

2626
struct rusage
2727
{

0 commit comments

Comments
 (0)