1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-22 21:53:06 +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

@@ -37,19 +37,19 @@ ts_lexize(PG_FUNCTION_ARGS)
dict = lookup_ts_dictionary_cache(dictId);
res = (TSLexeme *) DatumGetPointer(FunctionCall4(&dict->lexize,
PointerGetDatum(dict->dictData),
PointerGetDatum(VARDATA_ANY(in)),
Int32GetDatum(VARSIZE_ANY_EXHDR(in)),
PointerGetDatum(&dstate)));
PointerGetDatum(dict->dictData),
PointerGetDatum(VARDATA_ANY(in)),
Int32GetDatum(VARSIZE_ANY_EXHDR(in)),
PointerGetDatum(&dstate)));
if (dstate.getnext)
{
dstate.isend = true;
ptr = (TSLexeme *) DatumGetPointer(FunctionCall4(&dict->lexize,
PointerGetDatum(dict->dictData),
PointerGetDatum(VARDATA_ANY(in)),
Int32GetDatum(VARSIZE_ANY_EXHDR(in)),
PointerGetDatum(&dstate)));
PointerGetDatum(dict->dictData),
PointerGetDatum(VARDATA_ANY(in)),
Int32GetDatum(VARSIZE_ANY_EXHDR(in)),
PointerGetDatum(&dstate)));
if (ptr != NULL)
res = ptr;
}

View File

@@ -51,8 +51,8 @@ dispell_init(PG_FUNCTION_ARGS)
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("multiple DictFile parameters")));
NIImportDictionary(&(d->obj),
get_tsearch_config_filename(defGetString(defel),
"dict"));
get_tsearch_config_filename(defGetString(defel),
"dict"));
dictloaded = true;
}
else if (pg_strcasecmp(defel->defname, "AffFile") == 0)

View File

@@ -63,8 +63,8 @@ dsimple_init(PG_FUNCTION_ARGS)
{
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("unrecognized simple dictionary parameter: \"%s\"",
defel->defname)));
errmsg("unrecognized simple dictionary parameter: \"%s\"",
defel->defname)));
}
}

View File

@@ -410,10 +410,10 @@ compileTheLexeme(DictThesaurus *d)
else
{
ptr = (TSLexeme *) DatumGetPointer(FunctionCall4(&(d->subdict->lexize),
PointerGetDatum(d->subdict->dictData),
PointerGetDatum(d->wrds[i].lexeme),
Int32GetDatum(strlen(d->wrds[i].lexeme)),
PointerGetDatum(NULL)));
PointerGetDatum(d->subdict->dictData),
PointerGetDatum(d->wrds[i].lexeme),
Int32GetDatum(strlen(d->wrds[i].lexeme)),
PointerGetDatum(NULL)));
if (!ptr)
ereport(ERROR,
@@ -535,11 +535,11 @@ compileTheSubstitute(DictThesaurus *d)
{
lexized = (TSLexeme *) DatumGetPointer(
FunctionCall4(
&(d->subdict->lexize),
PointerGetDatum(d->subdict->dictData),
PointerGetDatum(inptr->lexeme),
Int32GetDatum(strlen(inptr->lexeme)),
PointerGetDatum(NULL)
&(d->subdict->lexize),
PointerGetDatum(d->subdict->dictData),
PointerGetDatum(inptr->lexeme),
Int32GetDatum(strlen(inptr->lexeme)),
PointerGetDatum(NULL)
)
);
}
@@ -816,7 +816,7 @@ thesaurus_lexize(PG_FUNCTION_ARGS)
d->subdict = lookup_ts_dictionary_cache(d->subdictOid);
res = (TSLexeme *) DatumGetPointer(FunctionCall4(&(d->subdict->lexize),
PointerGetDatum(d->subdict->dictData),
PointerGetDatum(d->subdict->dictData),
PG_GETARG_DATUM(1),
PG_GETARG_DATUM(2),
PointerGetDatum(NULL)));

View File

@@ -411,8 +411,8 @@ getNextFlagFromString(IspellDict *Conf, char **sflagset, char *sflag)
{
ereport(ERROR,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("invalid character in affix flag \"%s\"",
*sflagset)));
errmsg("invalid character in affix flag \"%s\"",
*sflagset)));
}
*sflagset += pg_mblen(*sflagset);
@@ -1088,7 +1088,7 @@ addCompoundAffixFlagValue(IspellDict *Conf, char *s, uint32 val)
Conf->mCompoundAffixFlag *= 2;
Conf->CompoundAffixFlags = (CompoundAffixFlag *)
repalloc((void *) Conf->CompoundAffixFlags,
Conf->mCompoundAffixFlag * sizeof(CompoundAffixFlag));
Conf->mCompoundAffixFlag * sizeof(CompoundAffixFlag));
}
else
{
@@ -1306,7 +1306,7 @@ NIImportOOAffixes(IspellDict *Conf, const char *filename)
if (naffix == 0)
ereport(ERROR,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("invalid number of flag vector aliases")));
errmsg("invalid number of flag vector aliases")));
/* Also reserve place for empty flag set */
naffix++;
@@ -1539,7 +1539,7 @@ isnewformat:
if (oldformat)
ereport(ERROR,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("affix file contains both old-style and new-style commands")));
errmsg("affix file contains both old-style and new-style commands")));
tsearch_readline_end(&trst);
NIImportOOAffixes(Conf, filename);
@@ -1566,7 +1566,7 @@ MergeAffix(IspellDict *Conf, int a1, int a2)
{
Conf->lenAffixData *= 2;
Conf->AffixData = (char **) repalloc(Conf->AffixData,
sizeof(char *) * Conf->lenAffixData);
sizeof(char *) * Conf->lenAffixData);
}
ptr = Conf->AffixData + Conf->nAffixData;
@@ -1664,7 +1664,7 @@ mkSPNode(IspellDict *Conf, int low, int high, int level)
*/
clearCompoundOnly = (FF_COMPOUNDONLY & data->compoundflag
& makeCompoundFlags(Conf, Conf->Spell[i]->p.d.affix))
& makeCompoundFlags(Conf, Conf->Spell[i]->p.d.affix))
? false : true;
data->affix = MergeAffix(Conf, data->affix, Conf->Spell[i]->p.d.affix);
}

View File

@@ -49,8 +49,8 @@ compareWORD(const void *a, const void *b)
int res;
res = tsCompareString(
((const ParsedWord *) a)->word, ((const ParsedWord *) a)->len,
((const ParsedWord *) b)->word, ((const ParsedWord *) b)->len,
((const ParsedWord *) a)->word, ((const ParsedWord *) a)->len,
((const ParsedWord *) b)->word, ((const ParsedWord *) b)->len,
false);
if (res == 0)
@@ -390,8 +390,8 @@ add_to_tsvector(void *_state, char *elem_value, int elem_len)
item_vector = make_tsvector(prs);
state->result = (TSVector) DirectFunctionCall2(tsvector_concat,
TSVectorGetDatum(state->result),
PointerGetDatum(item_vector));
TSVectorGetDatum(state->result),
PointerGetDatum(item_vector));
}
else
state->result = make_tsvector(prs);
@@ -472,7 +472,7 @@ pushval_morph(Datum opaque, TSQueryParserState state, char *strval, int lenval,
prs.words[count].word,
prs.words[count].len,
weight,
((prs.words[count].flags & TSL_PREFIX) || prefix));
((prs.words[count].flags & TSL_PREFIX) || prefix));
pfree(prs.words[count].word);
if (cnt)
pushOperator(state, OP_AND, 0);

View File

@@ -296,7 +296,7 @@ lowerstr_with_len(const char *str, int len)
if (wlen < 0)
ereport(ERROR,
(errcode(ERRCODE_CHARACTER_NOT_IN_REPERTOIRE),
errmsg("conversion from wchar_t to server encoding failed: %m")));
errmsg("conversion from wchar_t to server encoding failed: %m")));
Assert(wlen < len);
}
else

View File

@@ -205,11 +205,11 @@ LexizeExec(LexizeData *ld, ParsedLex **correspondLexem)
ld->dictState.isend = ld->dictState.getnext = false;
ld->dictState.private_state = NULL;
res = (TSLexeme *) DatumGetPointer(FunctionCall4(
&(dict->lexize),
PointerGetDatum(dict->dictData),
PointerGetDatum(curValLemm),
Int32GetDatum(curValLenLemm),
PointerGetDatum(&ld->dictState)
&(dict->lexize),
PointerGetDatum(dict->dictData),
PointerGetDatum(curValLemm),
Int32GetDatum(curValLenLemm),
PointerGetDatum(&ld->dictState)
));
if (ld->dictState.getnext)
@@ -295,10 +295,10 @@ LexizeExec(LexizeData *ld, ParsedLex **correspondLexem)
res = (TSLexeme *) DatumGetPointer(FunctionCall4(
&(dict->lexize),
PointerGetDatum(dict->dictData),
PointerGetDatum(curVal->lemm),
Int32GetDatum(curVal->lenlemm),
PointerGetDatum(&ld->dictState)
PointerGetDatum(dict->dictData),
PointerGetDatum(curVal->lemm),
Int32GetDatum(curVal->lenlemm),
PointerGetDatum(&ld->dictState)
));
if (ld->dictState.getnext)

View File

@@ -188,7 +188,7 @@ compute_tsvector_stats(VacAttrStats *stats,
lexemes_tab = hash_create("Analyzed lexemes table",
num_mcelem,
&hash_ctl,
HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT);
HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT);
/* Initialize counters. */
b_current = 1;
@@ -396,7 +396,7 @@ compute_tsvector_stats(VacAttrStats *stats,
mcelem_values[i] =
PointerGetDatum(cstring_to_text_with_len(item->key.lexeme,
item->key.length));
item->key.length));
mcelem_freqs[i] = (double) item->frequency / (double) nonnull_cnt;
}
mcelem_freqs[i++] = (double) minfreq / (double) nonnull_cnt;

View File

@@ -186,8 +186,8 @@ prs_setup_firstcall(FuncCallContext *funcctx, Oid prsid, text *txt)
st->list = (LexemeEntry *) palloc(sizeof(LexemeEntry) * st->len);
prsdata = (void *) DatumGetPointer(FunctionCall2(&prs->prsstart,
PointerGetDatum(VARDATA_ANY(txt)),
Int32GetDatum(VARSIZE_ANY_EXHDR(txt))));
PointerGetDatum(VARDATA_ANY(txt)),
Int32GetDatum(VARSIZE_ANY_EXHDR(txt))));
while ((type = DatumGetInt32(FunctionCall3(&prs->prstoken,
PointerGetDatum(prsdata),
@@ -319,7 +319,7 @@ ts_headline_byid_opt(PG_FUNCTION_ARGS)
if (!OidIsValid(prsobj->headlineOid))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("text search parser does not support headline creation")));
errmsg("text search parser does not support headline creation")));
memset(&prs, 0, sizeof(HeadlineParsedText));
prs.lenwords = 32;
@@ -364,7 +364,7 @@ Datum
ts_headline(PG_FUNCTION_ARGS)
{
PG_RETURN_DATUM(DirectFunctionCall3(ts_headline_byid_opt,
ObjectIdGetDatum(getTSCurrentConfig(true)),
ObjectIdGetDatum(getTSCurrentConfig(true)),
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1)));
}
@@ -373,7 +373,7 @@ Datum
ts_headline_opt(PG_FUNCTION_ARGS)
{
PG_RETURN_DATUM(DirectFunctionCall4(ts_headline_byid_opt,
ObjectIdGetDatum(getTSCurrentConfig(true)),
ObjectIdGetDatum(getTSCurrentConfig(true)),
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1),
PG_GETARG_DATUM(2)));
@@ -407,7 +407,7 @@ ts_headline_jsonb_byid_opt(PG_FUNCTION_ARGS)
if (!OidIsValid(state->prsobj->headlineOid))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("text search parser does not support headline creation")));
errmsg("text search parser does not support headline creation")));
out = transform_jsonb_string_values(jb, state, action);
@@ -431,7 +431,7 @@ Datum
ts_headline_jsonb(PG_FUNCTION_ARGS)
{
PG_RETURN_DATUM(DirectFunctionCall3(ts_headline_jsonb_byid_opt,
ObjectIdGetDatum(getTSCurrentConfig(true)),
ObjectIdGetDatum(getTSCurrentConfig(true)),
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1)));
}
@@ -449,7 +449,7 @@ Datum
ts_headline_jsonb_opt(PG_FUNCTION_ARGS)
{
PG_RETURN_DATUM(DirectFunctionCall4(ts_headline_jsonb_byid_opt,
ObjectIdGetDatum(getTSCurrentConfig(true)),
ObjectIdGetDatum(getTSCurrentConfig(true)),
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1),
PG_GETARG_DATUM(2)));
@@ -484,7 +484,7 @@ ts_headline_json_byid_opt(PG_FUNCTION_ARGS)
if (!OidIsValid(state->prsobj->headlineOid))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("text search parser does not support headline creation")));
errmsg("text search parser does not support headline creation")));
out = transform_json_string_values(json, state, action);
@@ -507,7 +507,7 @@ Datum
ts_headline_json(PG_FUNCTION_ARGS)
{
PG_RETURN_DATUM(DirectFunctionCall3(ts_headline_json_byid_opt,
ObjectIdGetDatum(getTSCurrentConfig(true)),
ObjectIdGetDatum(getTSCurrentConfig(true)),
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1)));
}
@@ -525,7 +525,7 @@ Datum
ts_headline_json_opt(PG_FUNCTION_ARGS)
{
PG_RETURN_DATUM(DirectFunctionCall4(ts_headline_json_byid_opt,
ObjectIdGetDatum(getTSCurrentConfig(true)),
ObjectIdGetDatum(getTSCurrentConfig(true)),
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1),
PG_GETARG_DATUM(2)));

View File

@@ -2295,7 +2295,7 @@ mark_hl_fragments(HeadlineParsedText *prs, TSQuery query, int highlight,
{
if (!covers[i].in && !covers[i].excluded &&
(maxitems < covers[i].poslen || (maxitems == covers[i].poslen
&& minwords > covers[i].curlen)))
&& minwords > covers[i].curlen)))
{
maxitems = covers[i].poslen;
minwords = covers[i].curlen;