1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-19 13:42:17 +03:00

Phase 3 of pgindent updates.

Don't move parenthesized lines to the left, even if that means they
flow past the right margin.

By default, BSD indent lines up statement continuation lines that are
within parentheses so that they start just to the right of the preceding
left parenthesis.  However, traditionally, if that resulted in the
continuation line extending to the right of the desired right margin,
then indent would push it left just far enough to not overrun the margin,
if it could do so without making the continuation line start to the left of
the current statement indent.  That makes for a weird mix of indentations
unless one has been completely rigid about never violating the 80-column
limit.

This behavior has been pretty universally panned by Postgres developers.
Hence, disable it with indent's new -lpl switch, so that parenthesized
lines are always lined up with the preceding left paren.

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
This commit is contained in:
Tom Lane
2017-06-21 15:35:54 -04:00
parent c7b8998ebb
commit 382ceffdf7
568 changed files with 4747 additions and 4745 deletions

View File

@@ -357,7 +357,7 @@ ltsReleaseBlock(LogicalTapeSet *lts, long blocknum)
{
lts->freeBlocksLen *= 2;
lts->freeBlocks = (long *) repalloc(lts->freeBlocks,
lts->freeBlocksLen * sizeof(long));
lts->freeBlocksLen * sizeof(long));
}
/*

View File

@@ -726,7 +726,7 @@ tuplesort_begin_common(int workMem, bool randomAccess)
* see comments in grow_memtuples().
*/
state->memtupsize = Max(1024,
ALLOCSET_SEPARATE_THRESHOLD / sizeof(SortTuple) + 1);
ALLOCSET_SEPARATE_THRESHOLD / sizeof(SortTuple) + 1);
state->growmemtuples = true;
state->slabAllocatorUsed = false;
@@ -1989,7 +1989,7 @@ tuplesort_gettuple_common(Tuplesortstate *state, bool forward,
*/
nmoved = LogicalTapeBackspace(state->tapeset,
state->result_tape,
tuplen + 2 * sizeof(unsigned int));
tuplen + 2 * sizeof(unsigned int));
if (nmoved == tuplen + sizeof(unsigned int))
{
/*
@@ -3971,7 +3971,7 @@ copytup_cluster(Tuplesortstate *state, SortTuple *stup, void *tup)
tuple = (HeapTuple) mtup->tuple;
mtup->datum1 = heap_getattr(tuple,
state->indexInfo->ii_KeyAttrNumbers[0],
state->indexInfo->ii_KeyAttrNumbers[0],
state->tupDesc,
&mtup->isnull1);
}
@@ -4143,7 +4143,7 @@ comparetup_index_btree(const SortTuple *a, const SortTuple *b,
key_desc ? errdetail("Key %s is duplicated.", key_desc) :
errdetail("Duplicate keys exist."),
errtableconstraint(state->heapRel,
RelationGetRelationName(state->indexRel))));
RelationGetRelationName(state->indexRel))));
}
/*
@@ -4348,7 +4348,7 @@ comparetup_datum(const SortTuple *a, const SortTuple *b, Tuplesortstate *state)
if (state->sortKeys->abbrev_converter)
compare = ApplySortAbbrevFullComparator(PointerGetDatum(a->tuple), a->isnull1,
PointerGetDatum(b->tuple), b->isnull1,
PointerGetDatum(b->tuple), b->isnull1,
state->sortKeys);
return compare;

View File

@@ -866,7 +866,7 @@ tuplestore_puttuple_common(Tuplestorestate *state, void *tuple)
SEEK_SET) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not seek in tuplestore temporary file: %m")));
errmsg("could not seek in tuplestore temporary file: %m")));
state->status = TSS_WRITEFILE;
/*
@@ -1051,7 +1051,7 @@ tuplestore_gettuple(Tuplestorestate *state, bool forward,
SEEK_CUR) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not seek in tuplestore temporary file: %m")));
errmsg("could not seek in tuplestore temporary file: %m")));
tup = READTUP(state, tuplen);
return tup;
@@ -1253,7 +1253,7 @@ tuplestore_rescan(Tuplestorestate *state)
if (BufFileSeek(state->myfile, 0, 0L, SEEK_SET) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not seek in tuplestore temporary file: %m")));
errmsg("could not seek in tuplestore temporary file: %m")));
break;
default:
elog(ERROR, "invalid tuplestore state");
@@ -1474,7 +1474,7 @@ getlen(Tuplestorestate *state, bool eofOK)
if (nbytes != 0 || !eofOK)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not read from tuplestore temporary file: %m")));
errmsg("could not read from tuplestore temporary file: %m")));
return 0;
}
@@ -1526,7 +1526,7 @@ writetup_heap(Tuplestorestate *state, void *tup)
sizeof(tuplen)) != sizeof(tuplen))
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not write to tuplestore temporary file: %m")));
errmsg("could not write to tuplestore temporary file: %m")));
FREEMEM(state, GetMemoryChunkSpace(tuple));
heap_free_minimal_tuple(tuple);
@@ -1547,12 +1547,12 @@ readtup_heap(Tuplestorestate *state, unsigned int len)
tupbodylen) != (size_t) tupbodylen)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not read from tuplestore temporary file: %m")));
errmsg("could not read from tuplestore temporary file: %m")));
if (state->backward) /* need trailing length word? */
if (BufFileRead(state->myfile, (void *) &tuplen,
sizeof(tuplen)) != sizeof(tuplen))
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not read from tuplestore temporary file: %m")));
errmsg("could not read from tuplestore temporary file: %m")));
return (void *) tuple;
}