diff options
| author | Bruce Momjian | 2005-05-25 21:40:43 +0000 |
|---|---|---|
| committer | Bruce Momjian | 2005-05-25 21:40:43 +0000 |
| commit | b492c3acccb3f8c97559ddfc2a25f25953a026d2 (patch) | |
| tree | a9c42aa2bd86a88a849ffaa005766ffe3dee762a /src/include/c.h | |
| parent | 13b729ca5267b58005f1ca9c873a86c2b0db3591 (diff) | |
Add parentheses to macros when args are used in computations. Without
them, the executation behavior could be unexpected.
Diffstat (limited to 'src/include/c.h')
| -rw-r--r-- | src/include/c.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/include/c.h b/src/include/c.h index e57c8e9daa..6318c5573d 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)) |
