1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-03 09:13:20 +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

@@ -202,7 +202,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
else
{
ecpg_raise(lineno, ECPG_MISSING_INDICATOR,
ECPG_SQLSTATE_NULL_VALUE_NO_INDICATOR_PARAMETER,
ECPG_SQLSTATE_NULL_VALUE_NO_INDICATOR_PARAMETER,
NULL);
return (false);
}
@@ -580,7 +580,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
else
{
ecpg_raise(lineno, ECPG_OUT_OF_MEMORY,
ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
return (false);
}
}

View File

@@ -44,7 +44,7 @@ ecpg_raise(int line, int code, const char *sqlstate, const char *str)
snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
/*------
translator: this string will be truncated at 149 characters expanded. */
ecpg_gettext("unsupported type \"%s\" on line %d"), str, line);
ecpg_gettext("unsupported type \"%s\" on line %d"), str, line);
break;
case ECPG_TOO_MANY_ARGUMENTS:
@@ -106,7 +106,7 @@ ecpg_raise(int line, int code, const char *sqlstate, const char *str)
snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
/*------
translator: this string will be truncated at 149 characters expanded. */
ecpg_gettext("null value without indicator on line %d"), line);
ecpg_gettext("null value without indicator on line %d"), line);
break;
case ECPG_NO_ARRAY:
@@ -162,7 +162,7 @@ ecpg_raise(int line, int code, const char *sqlstate, const char *str)
snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
/*------
translator: this string will be truncated at 149 characters expanded. */
ecpg_gettext("descriptor index out of range on line %d"), line);
ecpg_gettext("descriptor index out of range on line %d"), line);
break;
case ECPG_UNKNOWN_DESCRIPTOR_ITEM:
@@ -190,7 +190,7 @@ ecpg_raise(int line, int code, const char *sqlstate, const char *str)
snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
/*------
translator: this string will be truncated at 149 characters expanded. */
ecpg_gettext("error in transaction processing on line %d"), line);
ecpg_gettext("error in transaction processing on line %d"), line);
break;
case ECPG_CONNECT:

View File

@@ -431,7 +431,7 @@ ecpg_store_result(const PGresult *results, int act_field,
int len = strlen(PQgetvalue(results, act_tuple, act_field)) + 1;
if (!ecpg_get_data(results, act_tuple, act_field, stmt->lineno,
var->type, var->ind_type, current_data_location,
var->type, var->ind_type, current_data_location,
var->ind_value, len, 0, var->ind_offset, isarray, stmt->compat, stmt->force_indicator))
status = false;
else
@@ -1389,7 +1389,7 @@ ecpg_build_params(struct statement *stmt)
if (next_insert(stmt->command, position, stmt->questionmarks) >= 0)
{
ecpg_raise(stmt->lineno, ECPG_TOO_FEW_ARGUMENTS,
ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS, NULL);
ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS, NULL);
ecpg_free_params(stmt, false);
return false;
}

View File

@@ -163,7 +163,7 @@ struct descriptor *ecpggetdescp(int, char *);
struct descriptor *ecpg_find_desc(int line, const char *name);
struct prepared_statement *ecpg_find_prepared_statement(const char *,
struct connection *, struct prepared_statement **);
struct connection *, struct prepared_statement **);
bool ecpg_store_result(const PGresult *results, int act_field,
const struct statement *stmt, struct variable *var);

View File

@@ -28,7 +28,7 @@ static const int stmtCacheEntPerBucket = 8; /* # entries/bucket */
static stmtCacheEntry stmtCacheEntries[16384] = {{0, {0}, 0, 0, 0}};
static bool deallocate_one(int lineno, enum COMPAT_MODE c, struct connection *con,
struct prepared_statement *prev, struct prepared_statement *this);
struct prepared_statement *prev, struct prepared_statement *this);
static bool
isvarchar(unsigned char c)
@@ -180,7 +180,7 @@ ECPGprepare(int lineno, const char *connection_name, const bool questionmarks, c
struct prepared_statement *
ecpg_find_prepared_statement(const char *name,
struct connection *con, struct prepared_statement **prev_)
struct connection *con, struct prepared_statement **prev_)
{
struct prepared_statement *this,
*prev;

View File

@@ -1204,7 +1204,7 @@ DecodeNumberField(int len, char *str, int fmask,
*/
static int
DecodeNumber(int flen, char *str, int fmask,
int *tmask, struct tm *tm, fsec_t *fsec, int *is2digits, bool EuroDates)
int *tmask, struct tm *tm, fsec_t *fsec, int *is2digits, bool EuroDates)
{
int val;
char *cp;
@@ -1894,7 +1894,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
* time
*/
if ((ftype[i] = DecodeNumberField(strlen(field[i]), field[i], fmask,
&tmask, tm, fsec, &is2digits)) < 0)
&tmask, tm, fsec, &is2digits)) < 0)
return -1;
/*
@@ -2074,7 +2074,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
case DTK_TIME:
/* previous field was "t" for ISO time */
if ((ftype[i] = DecodeNumberField(strlen(field[i]), field[i], (fmask | DTK_DATE_M),
&tmask, tm, fsec, &is2digits)) < 0)
&tmask, tm, fsec, &is2digits)) < 0)
return -1;
if (tmask != DTK_TIME_M)
@@ -2112,18 +2112,18 @@ DecodeDateTime(char **field, int *ftype, int nf,
* Example: 20011223 or 040506
*/
if ((ftype[i] = DecodeNumberField(flen, field[i], fmask,
&tmask, tm, fsec, &is2digits)) < 0)
&tmask, tm, fsec, &is2digits)) < 0)
return -1;
}
else if (flen > 4)
{
if ((ftype[i] = DecodeNumberField(flen, field[i], fmask,
&tmask, tm, fsec, &is2digits)) < 0)
&tmask, tm, fsec, &is2digits)) < 0)
return -1;
}
/* otherwise it is a single date/time field... */
else if (DecodeNumber(flen, field[i], fmask,
&tmask, tm, fsec, &is2digits, EuroDates) != 0)
&tmask, tm, fsec, &is2digits, EuroDates) != 0)
return -1;
}
break;
@@ -2151,7 +2151,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
*dtype = DTK_DATE;
GetCurrentDateTime(tm);
j2date(date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - 1,
&tm->tm_year, &tm->tm_mon, &tm->tm_mday);
&tm->tm_year, &tm->tm_mon, &tm->tm_mday);
tm->tm_hour = 0;
tm->tm_min = 0;
tm->tm_sec = 0;
@@ -2171,7 +2171,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
*dtype = DTK_DATE;
GetCurrentDateTime(tm);
j2date(date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) + 1,
&tm->tm_year, &tm->tm_mon, &tm->tm_mday);
&tm->tm_year, &tm->tm_mon, &tm->tm_mday);
tm->tm_hour = 0;
tm->tm_min = 0;
tm->tm_sec = 0;

View File

@@ -300,7 +300,7 @@ output_set_descr(char *desc_name, char *index)
fprintf(base_yyout, "%s,", get_dtype(results->value));
ECPGdump_a_type(base_yyout, v->name, v->type, v->brace_level,
NULL, NULL, -1, NULL, NULL, str_zero, NULL, NULL);
NULL, NULL, -1, NULL, NULL, str_zero, NULL, NULL);
free(str_zero);
}
break;

View File

@@ -51,7 +51,7 @@ help(const char *progname)
printf(_(" -I DIRECTORY search DIRECTORY for include files\n"));
printf(_(" -o OUTFILE write result to OUTFILE\n"));
printf(_(" -r OPTION specify run-time behavior; OPTION can be:\n"
" \"no_indicator\", \"prepare\", \"questionmarks\"\n"));
" \"no_indicator\", \"prepare\", \"questionmarks\"\n"));
printf(_(" --regression run in regression testing mode\n"));
printf(_(" -t turn on autocommit of transactions\n"));
printf(_(" -V, --version output version information, then exit\n"));

View File

@@ -237,7 +237,7 @@ static void ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, c
void
ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype *type, const int brace_level,
const char *ind_name, struct ECPGtype *ind_type, const int ind_brace_level,
const char *ind_name, struct ECPGtype *ind_type, const int ind_brace_level,
const char *prefix, const char *ind_prefix,
char *arr_str_size, const char *struct_sizeof,
const char *ind_struct_sizeof)