1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

Initial pgindent run with pg_bsd_indent version 2.0.

The new indent version includes numerous fixes thanks to Piotr Stefaniak.
The main changes visible in this commit are:

* Nicer formatting of function-pointer declarations.
* No longer unexpectedly removes spaces in expressions using casts,
  sizeof, or offsetof.
* No longer wants to add a space in "struct structname *varname", as
  well as some similar cases for const- or volatile-qualified pointers.
* Declarations using PG_USED_FOR_ASSERTS_ONLY are formatted more nicely.
* Fixes bug where comments following declarations were sometimes placed
  with no space separating them from the code.
* Fixes some odd decisions for comments following case labels.
* Fixes some cases where comments following code were indented to less
  than the expected column 33.

On the less good side, it now tends to put more whitespace around typedef
names that are not listed in typedefs.list.  This might encourage us to
put more effort into typedef name collection; it's not really a bug in
indent itself.

There are more changes coming after this round, having to do with comment
indentation and alignment of lines appearing within parentheses.  I wanted
to limit the size of the diffs to something that could be reviewed without
one's eyes completely glazing over, so it seemed better to split up the
changes as much as practical.

Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
This commit is contained in:
Tom Lane
2017-06-21 14:39:04 -04:00
parent 8ff6d4ec78
commit e3860ffa4d
379 changed files with 1725 additions and 1707 deletions

View File

@ -455,7 +455,7 @@ timestamptz_in(PG_FUNCTION_ARGS)
* don't care, so we don't bother being consistent.
*/
static int
parse_sane_timezone(struct pg_tm * tm, text *zone)
parse_sane_timezone(struct pg_tm *tm, text *zone)
{
char tzname[TZ_STRLEN_MAX + 1];
int rt;
@ -1526,7 +1526,7 @@ EncodeSpecialTimestamp(Timestamp dt, char *str)
strcpy(str, EARLY);
else if (TIMESTAMP_IS_NOEND(dt))
strcpy(str, LATE);
else /* shouldn't happen */
else /* shouldn't happen */
elog(ERROR, "invalid argument for EncodeSpecialTimestamp");
}
@ -1740,7 +1740,7 @@ dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec)
time -= (*min) * USECS_PER_MINUTE;
*sec = time / USECS_PER_SEC;
*fsec = time - (*sec * USECS_PER_SEC);
} /* dt2time() */
} /* dt2time() */
/*
@ -1755,7 +1755,7 @@ dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec)
* If attimezone is NULL, the global timezone setting will be used.
*/
int
timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm, fsec_t *fsec, const char **tzn, pg_tz *attimezone)
timestamp2tm(Timestamp dt, int *tzp, struct pg_tm *tm, fsec_t *fsec, const char **tzn, pg_tz *attimezone)
{
Timestamp date;
Timestamp time;
@ -1851,7 +1851,7 @@ timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm, fsec_t *fsec, const char
* Returns -1 on failure (value out of range).
*/
int
tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result)
tm2timestamp(struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *result)
{
TimeOffset date;
TimeOffset time;
@ -1899,7 +1899,7 @@ tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result)
* Convert an interval data type to a tm structure.
*/
int
interval2tm(Interval span, struct pg_tm * tm, fsec_t *fsec)
interval2tm(Interval span, struct pg_tm *tm, fsec_t *fsec)
{
TimeOffset time;
TimeOffset tfrac;
@ -1927,7 +1927,7 @@ interval2tm(Interval span, struct pg_tm * tm, fsec_t *fsec)
}
int
tm2interval(struct pg_tm * tm, fsec_t fsec, Interval *span)
tm2interval(struct pg_tm *tm, fsec_t fsec, Interval *span)
{
double total_months = (double) tm->tm_year * MONTHS_PER_YEAR + tm->tm_mon;
@ -1981,7 +1981,7 @@ interval_finite(PG_FUNCTION_ARGS)
*---------------------------------------------------------*/
void
GetEpochTime(struct pg_tm * tm)
GetEpochTime(struct pg_tm *tm)
{
struct pg_tm *t0;
pg_time_t epoch = 0;
@ -2011,7 +2011,7 @@ SetEpochTimestamp(void)
tm2timestamp(tm, 0, NULL, &dt);
return dt;
} /* SetEpochTimestamp() */
} /* SetEpochTimestamp() */
/*
* We are currently sharing some code between timestamp and timestamptz.
@ -4930,7 +4930,7 @@ timestamp_izone(PG_FUNCTION_ARGS)
errmsg("timestamp out of range")));
PG_RETURN_TIMESTAMPTZ(result);
} /* timestamp_izone() */
} /* timestamp_izone() */
/* timestamp_timestamptz()
* Convert local timestamp to timestamp at GMT