summaryrefslogtreecommitdiff
path: root/src/timezone
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-06-21 15:18:54 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-06-21 15:19:25 -0400
commitc7b8998ebbf310a156aa38022555a24d98fdbfb4 (patch)
treee85979fb1213a731b7b557f8a830df541f26b135 /src/timezone
parentf669c09989bda894d6ba01634ccb229f0687c08a (diff)
downloadpostgresql-c7b8998ebbf310a156aa38022555a24d98fdbfb4.tar.gz
Phase 2 of pgindent updates.
Change pg_bsd_indent to follow upstream rules for placement of comments to the right of code, and remove pgindent hack that caused comments following #endif to not obey the general rule. Commit e3860ffa4dd0dad0dd9eea4be9cc1412373a8c89 wasn't actually using the published version of pg_bsd_indent, but a hacked-up version that tried to minimize the amount of movement of comments to the right of code. The situation of interest is where such a comment has to be moved to the right of its default placement at column 33 because there's code there. BSD indent has always moved right in units of tab stops in such cases --- but in the previous incarnation, indent was working in 8-space tab stops, while now it knows we use 4-space tabs. So the net result is that in about half the cases, such comments are placed one tab stop left of before. This is better all around: it leaves more room on the line for comment text, and it means that in such cases the comment uniformly starts at the next 4-space tab stop after the code, rather than sometimes one and sometimes two tabs after. Also, ensure that comments following #endif are indented the same as comments following other preprocessor commands such as #else. That inconsistency turns out to have been self-inflicted damage from a poorly-thought-through post-indent "fixup" in pgindent. This patch is much less interesting than the first round of indent changes, but also bulkier, so I thought it best to separate the effects. Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
Diffstat (limited to 'src/timezone')
-rw-r--r--src/timezone/localtime.c8
-rw-r--r--src/timezone/pgtz.h2
-rw-r--r--src/timezone/private.h8
-rw-r--r--src/timezone/strftime.c2
-rw-r--r--src/timezone/tzfile.h8
-rw-r--r--src/timezone/zic.c16
6 files changed, 22 insertions, 22 deletions
diff --git a/src/timezone/localtime.c b/src/timezone/localtime.c
index 76d96ff631..08642d1236 100644
--- a/src/timezone/localtime.c
+++ b/src/timezone/localtime.c
@@ -44,7 +44,7 @@
* that tzname[0] has the "normal" length of three characters).
*/
#define WILDABBR " "
-#endif /* !defined WILDABBR */
+#endif /* !defined WILDABBR */
static const char wildabbr[] = WILDABBR;
@@ -270,7 +270,7 @@ tzloadbody(char const *name, char *canonname, struct state *sp, bool doextend,
return EINVAL;
if (nread
< (tzheadsize /* struct tzhead */
- + timecnt * stored /* ats */
+ + timecnt * stored /* ats */
+ timecnt /* types */
+ typecnt * 6 /* ttinfos */
+ charcnt /* chars */
@@ -788,7 +788,7 @@ getrule(const char *strp, struct rule *rulep)
strp = getoffset(strp, &rulep->r_time);
}
else
- rulep->r_time = 2 * SECSPERHOUR; /* default = 2:00:00 */
+ rulep->r_time = 2 * SECSPERHOUR; /* default = 2:00:00 */
return strp;
}
@@ -921,7 +921,7 @@ tzparse(const char *name, struct state *sp, bool lastditch)
stdlen = (sizeof sp->chars) - 1;
charcnt = stdlen + 1;
stdoffset = 0;
- sp->goback = sp->goahead = false; /* simulate failed tzload() */
+ sp->goback = sp->goahead = false; /* simulate failed tzload() */
load_ok = false;
}
else
diff --git a/src/timezone/pgtz.h b/src/timezone/pgtz.h
index f5aec6e529..3d89ba00a7 100644
--- a/src/timezone/pgtz.h
+++ b/src/timezone/pgtz.h
@@ -72,4 +72,4 @@ extern int tzload(const char *name, char *canonname, struct state *sp,
bool doextend);
extern bool tzparse(const char *name, struct state *sp, bool lastditch);
-#endif /* _PGTZ_H */
+#endif /* _PGTZ_H */
diff --git a/src/timezone/private.h b/src/timezone/private.h
index f031b17b7e..c141fb6131 100644
--- a/src/timezone/private.h
+++ b/src/timezone/private.h
@@ -40,10 +40,10 @@
#ifndef WIFEXITED
#define WIFEXITED(status) (((status) & 0xff) == 0)
-#endif /* !defined WIFEXITED */
+#endif /* !defined WIFEXITED */
#ifndef WEXITSTATUS
#define WEXITSTATUS(status) (((status) >> 8) & 0xff)
-#endif /* !defined WEXITSTATUS */
+#endif /* !defined WEXITSTATUS */
/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
#define is_digit(c) ((unsigned)(c) - '0' <= 9)
@@ -60,7 +60,7 @@
extern int unlink(const char *filename);
#define remove unlink
-#endif /* !defined remove */
+#endif /* !defined remove */
/*
@@ -166,4 +166,4 @@ extern int unlink(const char *filename);
((int64) YEARSPERREPEAT * (int64) AVGSECSPERYEAR)
#define SECSPERREPEAT_BITS 34 /* ceil(log2(SECSPERREPEAT)) */
-#endif /* !defined PRIVATE_H */
+#endif /* !defined PRIVATE_H */
diff --git a/src/timezone/strftime.c b/src/timezone/strftime.c
index 9c9baee0b1..7cbafc9d83 100644
--- a/src/timezone/strftime.c
+++ b/src/timezone/strftime.c
@@ -245,7 +245,7 @@ _fmt(const char *format, const struct pg_tm *t, char *pt, const char *ptlim,
*/
pt = _add("kitchen sink", pt, ptlim);
continue;
-#endif /* defined KITCHEN_SINK */
+#endif /* defined KITCHEN_SINK */
case 'l':
/*
diff --git a/src/timezone/tzfile.h b/src/timezone/tzfile.h
index 56a5b43472..2843833e49 100644
--- a/src/timezone/tzfile.h
+++ b/src/timezone/tzfile.h
@@ -34,9 +34,9 @@ struct tzhead
{
char tzh_magic[4]; /* TZ_MAGIC */
char tzh_version[1]; /* '\0' or '2' or '3' as of 2013 */
- char tzh_reserved[15]; /* reserved; must be zero */
- char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */
- char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
+ char tzh_reserved[15]; /* reserved; must be zero */
+ char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */
+ char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
char tzh_leapcnt[4]; /* coded number of leap seconds */
char tzh_timecnt[4]; /* coded number of transition times */
char tzh_typecnt[4]; /* coded number of local time types */
@@ -100,4 +100,4 @@ struct tzhead
#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */
-#endif /* !defined TZFILE_H */
+#endif /* !defined TZFILE_H */
diff --git a/src/timezone/zic.c b/src/timezone/zic.c
index a38cadff58..27c841be9e 100644
--- a/src/timezone/zic.c
+++ b/src/timezone/zic.c
@@ -27,7 +27,7 @@ typedef int64 zic_t;
#ifndef ZIC_MAX_ABBR_LEN_WO_WARN
#define ZIC_MAX_ABBR_LEN_WO_WARN 6
-#endif /* !defined ZIC_MAX_ABBR_LEN_WO_WARN */
+#endif /* !defined ZIC_MAX_ABBR_LEN_WO_WARN */
#ifndef WIN32
#ifdef S_IRUSR
@@ -83,9 +83,9 @@ struct rule
* r_dycode r_dayofmonth r_wday
*/
-#define DC_DOM 0 /* 1..31 */ /* unused */
-#define DC_DOWGEQ 1 /* 1..31 */ /* 0..6 (Sun..Sat) */
-#define DC_DOWLEQ 2 /* 1..31 */ /* 0..6 (Sun..Sat) */
+#define DC_DOM 0 /* 1..31 */ /* unused */
+#define DC_DOWGEQ 1 /* 1..31 */ /* 0..6 (Sun..Sat) */
+#define DC_DOWLEQ 2 /* 1..31 */ /* 0..6 (Sun..Sat) */
struct zone
{
@@ -572,7 +572,7 @@ main(int argc, char *argv[])
#ifndef WIN32
umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH));
-#endif /* !WIN32 */
+#endif /* !WIN32 */
progname = argv[0];
if (TYPE_BIT(zic_t) <64)
{
@@ -852,7 +852,7 @@ relname(char const *from, char const *to)
}
return result;
}
-#endif /* HAVE_SYMLINK */
+#endif /* HAVE_SYMLINK */
/* Hard link FROM to TO, following any symbolic links.
Return 0 if successful, an error number otherwise. */
@@ -920,7 +920,7 @@ dolink(char const *fromfield, char const *tofield, bool staysymlink)
strerror(link_errno));
}
else
-#endif /* HAVE_SYMLINK */
+#endif /* HAVE_SYMLINK */
{
FILE *fp,
*tp;
@@ -2140,7 +2140,7 @@ writezone(const char *const name, const char *const string, char version)
writetype[type] = true;
}
}
-#endif /* !defined
+#endif /* !defined
* LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH */
thistypecnt = 0;
for (i = 0; i < typecnt; ++i)