diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-05-16 11:54:51 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-05-16 11:54:51 -0400 |
commit | fa27dd40d5c5f56a1ee837a75c97549e992e32a4 (patch) | |
tree | 029cb03671144ee7b0c48efe8469990003e3bc86 /src/timezone | |
parent | e02ad575d8ab6b44500d2a3fd8c3212345e3aa2b (diff) | |
download | postgresql-fa27dd40d5c5f56a1ee837a75c97549e992e32a4.tar.gz |
Run pgindent with new pg_bsd_indent version 2.1.1.
Thomas Munro fixed a longstanding annoyance in pg_bsd_indent, that
it would misformat lines containing IsA() macros on the assumption
that the IsA() call should be treated like a cast. This improves
some other cases involving field/variable names that match typedefs,
too. The only places that get worse are a couple of uses of the
OpenSSL macro STACK_OF(); we'll gladly take that trade-off.
Discussion: https://postgr.es/m/20200114221814.GA19630@alvherre.pgsql
Diffstat (limited to 'src/timezone')
-rw-r--r-- | src/timezone/localtime.c | 10 | ||||
-rw-r--r-- | src/timezone/strftime.c | 2 | ||||
-rw-r--r-- | src/timezone/zic.c | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/timezone/localtime.c b/src/timezone/localtime.c index 333f27300a..787f0b69d6 100644 --- a/src/timezone/localtime.c +++ b/src/timezone/localtime.c @@ -138,7 +138,7 @@ detzcode(const char *const codep) * Do two's-complement negation even on non-two's-complement machines. * If the result would be minval - 1, return minval. */ - result -= !TWOS_COMPLEMENT(int32) &&result != 0; + result -= !TWOS_COMPLEMENT(int32) && result != 0; result += minval; } return result; @@ -152,7 +152,7 @@ detzcode64(const char *const codep) int64 one = 1; int64 halfmaxval = one << (64 - 2); int64 maxval = halfmaxval - 1 + halfmaxval; - int64 minval = -TWOS_COMPLEMENT(int64) -maxval; + int64 minval = -TWOS_COMPLEMENT(int64) - maxval; result = codep[0] & 0x7f; for (i = 1; i < 8; ++i) @@ -164,7 +164,7 @@ detzcode64(const char *const codep) * Do two's-complement negation even on non-two's-complement machines. * If the result would be minval - 1, return minval. */ - result -= !TWOS_COMPLEMENT(int64) &&result != 0; + result -= !TWOS_COMPLEMENT(int64) && result != 0; result += minval; } return result; @@ -173,7 +173,7 @@ detzcode64(const char *const codep) static bool differ_by_repeat(const pg_time_t t1, const pg_time_t t0) { - if (TYPE_BIT(pg_time_t) -TYPE_SIGNED(pg_time_t) <SECSPERREPEAT_BITS) + if (TYPE_BIT(pg_time_t) - TYPE_SIGNED(pg_time_t) < SECSPERREPEAT_BITS) return 0; return t1 - t0 == SECSPERREPEAT; } @@ -1480,7 +1480,7 @@ timesub(const pg_time_t *timep, int32 offset, int leapdays; tdelta = tdays / DAYSPERLYEAR; - if (!((!TYPE_SIGNED(pg_time_t) ||INT_MIN <= tdelta) + if (!((!TYPE_SIGNED(pg_time_t) || INT_MIN <= tdelta) && tdelta <= INT_MAX)) goto out_of_range; idelta = tdelta; diff --git a/src/timezone/strftime.c b/src/timezone/strftime.c index 380b4888a5..4b942c393a 100644 --- a/src/timezone/strftime.c +++ b/src/timezone/strftime.c @@ -505,7 +505,7 @@ _fmt(const char *format, const struct pg_tm *t, char *pt, static char * _conv(int n, const char *format, char *pt, const char *ptlim) { - char buf[INT_STRLEN_MAXIMUM(int) +1]; + char buf[INT_STRLEN_MAXIMUM(int) + 1]; sprintf(buf, format, n); return _add(buf, pt, ptlim); diff --git a/src/timezone/zic.c b/src/timezone/zic.c index c27fb456d0..9df81824a0 100644 --- a/src/timezone/zic.c +++ b/src/timezone/zic.c @@ -652,7 +652,7 @@ main(int argc, char **argv) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH)); #endif progname = argv[0]; - if (TYPE_BIT(zic_t) <64) + if (TYPE_BIT(zic_t) < 64) { fprintf(stderr, "%s: %s\n", progname, _("wild compilation-time specification of zic_t")); @@ -3444,7 +3444,7 @@ yearistype(zic_t year, const char *type) if (type == NULL || *type == '\0') return true; buf = emalloc(1 + 4 * strlen(yitcommand) + 2 - + INT_STRLEN_MAXIMUM(zic_t) +2 + 4 * strlen(type) + 2); + + INT_STRLEN_MAXIMUM(zic_t) + 2 + 4 * strlen(type) + 2); b = shellquote(buf, yitcommand); *b++ = ' '; b += sprintf(b, INT64_FORMAT, year); |