From: Bruce Momjian Date: Tue, 24 May 2005 04:03:01 +0000 (+0000) Subject: Put parentheses around use of macro arguments in FMODULO and TMODULO. X-Git-Tag: REL8_1_0BETA1~746 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f534820d4dacbc100f371cdfbe6a60a10c3331be;p=postgresql Put parentheses around use of macro arguments in FMODULO and TMODULO. --- diff --git a/src/include/utils/datetime.h b/src/include/utils/datetime.h index 0c2da14a04..532cfb9206 100644 --- a/src/include/utils/datetime.h +++ b/src/include/utils/datetime.h @@ -9,7 +9,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/datetime.h,v 1.52 2004/12/31 22:03:45 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/utils/datetime.h,v 1.53 2005/05/24 04:03:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -203,8 +203,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() @@ -215,14 +215,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