diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-05-14 13:06:38 -0400 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-05-14 13:06:50 -0400 |
| commit | 5cbfce562f7cd2aab0cdc4694ce298ec3567930e (patch) | |
| tree | 64e722d72fc5f1803cb6f6371d6cf12863e2812f /src/backend/utils | |
| parent | 1255466f8358ecac29581aa5ecec76628dc2e33c (diff) | |
| download | postgresql-5cbfce562f7cd2aab0cdc4694ce298ec3567930e.tar.gz | |
Initial pgindent and pgperltidy run for v13.
Includes some manual cleanup of places that pgindent messed up,
most of which weren't per project style anyway.
Notably, it seems some people didn't absorb the style rules of
commit c9d297751, because there were a bunch of new occurrences
of function calls with a newline just after the left paren, all
with faulty expectations about how the rest of the call would get
indented.
Diffstat (limited to 'src/backend/utils')
| -rw-r--r-- | src/backend/utils/adt/datetime.c | 16 | ||||
| -rw-r--r-- | src/backend/utils/adt/int.c | 19 | ||||
| -rw-r--r-- | src/backend/utils/adt/int8.c | 19 | ||||
| -rw-r--r-- | src/backend/utils/adt/json.c | 2 | ||||
| -rw-r--r-- | src/backend/utils/adt/jsonfuncs.c | 13 | ||||
| -rw-r--r-- | src/backend/utils/adt/numutils.c | 32 | ||||
| -rw-r--r-- | src/backend/utils/adt/pgstatfuncs.c | 14 | ||||
| -rw-r--r-- | src/backend/utils/adt/rangetypes_spgist.c | 10 | ||||
| -rw-r--r-- | src/backend/utils/adt/regproc.c | 3 | ||||
| -rw-r--r-- | src/backend/utils/adt/ruleutils.c | 16 | ||||
| -rw-r--r-- | src/backend/utils/adt/tsgistidx.c | 12 | ||||
| -rw-r--r-- | src/backend/utils/cache/lsyscache.c | 8 | ||||
| -rw-r--r-- | src/backend/utils/cache/relcache.c | 11 | ||||
| -rw-r--r-- | src/backend/utils/error/elog.c | 4 | ||||
| -rw-r--r-- | src/backend/utils/hash/dynahash.c | 5 | ||||
| -rw-r--r-- | src/backend/utils/init/miscinit.c | 2 | ||||
| -rw-r--r-- | src/backend/utils/misc/guc.c | 2 | ||||
| -rw-r--r-- | src/backend/utils/mmgr/aset.c | 10 | ||||
| -rw-r--r-- | src/backend/utils/mmgr/mcxt.c | 2 | ||||
| -rw-r--r-- | src/backend/utils/mmgr/slab.c | 7 | ||||
| -rw-r--r-- | src/backend/utils/sort/logtape.c | 45 | ||||
| -rw-r--r-- | src/backend/utils/sort/tuplesort.c | 14 |
22 files changed, 139 insertions, 127 deletions
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 9c80894281..7a965973cd 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -3862,7 +3862,7 @@ EncodeDateOnly(struct pg_tm *tm, int style, char *str) case USE_XSD_DATES: /* compatible with ISO date formats */ str = pg_ultostr_zeropad(str, - (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); + (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); *str++ = '-'; str = pg_ultostr_zeropad(str, tm->tm_mon, 2); *str++ = '-'; @@ -3885,7 +3885,7 @@ EncodeDateOnly(struct pg_tm *tm, int style, char *str) } *str++ = '/'; str = pg_ultostr_zeropad(str, - (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); + (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); break; case USE_GERMAN_DATES: @@ -3895,7 +3895,7 @@ EncodeDateOnly(struct pg_tm *tm, int style, char *str) str = pg_ultostr_zeropad(str, tm->tm_mon, 2); *str++ = '.'; str = pg_ultostr_zeropad(str, - (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); + (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); break; case USE_POSTGRES_DATES: @@ -3915,7 +3915,7 @@ EncodeDateOnly(struct pg_tm *tm, int style, char *str) } *str++ = '-'; str = pg_ultostr_zeropad(str, - (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); + (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); break; } @@ -3985,7 +3985,7 @@ EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char case USE_XSD_DATES: /* Compatible with ISO-8601 date formats */ str = pg_ultostr_zeropad(str, - (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); + (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); *str++ = '-'; str = pg_ultostr_zeropad(str, tm->tm_mon, 2); *str++ = '-'; @@ -4016,7 +4016,7 @@ EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char } *str++ = '/'; str = pg_ultostr_zeropad(str, - (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); + (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); *str++ = ' '; str = pg_ultostr_zeropad(str, tm->tm_hour, 2); *str++ = ':'; @@ -4048,7 +4048,7 @@ EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char str = pg_ultostr_zeropad(str, tm->tm_mon, 2); *str++ = '.'; str = pg_ultostr_zeropad(str, - (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); + (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); *str++ = ' '; str = pg_ultostr_zeropad(str, tm->tm_hour, 2); *str++ = ':'; @@ -4098,7 +4098,7 @@ EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char str = AppendTimestampSeconds(str, tm, fsec); *str++ = ' '; str = pg_ultostr_zeropad(str, - (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); + (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); if (print_tz) { diff --git a/src/backend/utils/adt/int.c b/src/backend/utils/adt/int.c index 4acbc27d42..63c59c56b3 100644 --- a/src/backend/utils/adt/int.c +++ b/src/backend/utils/adt/int.c @@ -1213,8 +1213,9 @@ int2abs(PG_FUNCTION_ARGS) static int32 int4gcd_internal(int32 arg1, int32 arg2) { - int32 swap; - int32 a1, a2; + int32 swap; + int32 a1, + a2; /* * Put the greater absolute value in arg1. @@ -1273,9 +1274,9 @@ int4gcd_internal(int32 arg1, int32 arg2) Datum int4gcd(PG_FUNCTION_ARGS) { - int32 arg1 = PG_GETARG_INT32(0); - int32 arg2 = PG_GETARG_INT32(1); - int32 result; + int32 arg1 = PG_GETARG_INT32(0); + int32 arg2 = PG_GETARG_INT32(1); + int32 result; result = int4gcd_internal(arg1, arg2); @@ -1288,10 +1289,10 @@ int4gcd(PG_FUNCTION_ARGS) Datum int4lcm(PG_FUNCTION_ARGS) { - int32 arg1 = PG_GETARG_INT32(0); - int32 arg2 = PG_GETARG_INT32(1); - int32 gcd; - int32 result; + int32 arg1 = PG_GETARG_INT32(0); + int32 arg2 = PG_GETARG_INT32(1); + int32 gcd; + int32 result; /* * Handle lcm(x, 0) = lcm(0, x) = 0 as a special case. This prevents a diff --git a/src/backend/utils/adt/int8.c b/src/backend/utils/adt/int8.c index 55e0eb05da..abba8f1df0 100644 --- a/src/backend/utils/adt/int8.c +++ b/src/backend/utils/adt/int8.c @@ -684,8 +684,9 @@ int8mod(PG_FUNCTION_ARGS) static int64 int8gcd_internal(int64 arg1, int64 arg2) { - int64 swap; - int64 a1, a2; + int64 swap; + int64 a1, + a2; /* * Put the greater absolute value in arg1. @@ -744,9 +745,9 @@ int8gcd_internal(int64 arg1, int64 arg2) Datum int8gcd(PG_FUNCTION_ARGS) { - int64 arg1 = PG_GETARG_INT64(0); - int64 arg2 = PG_GETARG_INT64(1); - int64 result; + int64 arg1 = PG_GETARG_INT64(0); + int64 arg2 = PG_GETARG_INT64(1); + int64 result; result = int8gcd_internal(arg1, arg2); @@ -759,10 +760,10 @@ int8gcd(PG_FUNCTION_ARGS) Datum int8lcm(PG_FUNCTION_ARGS) { - int64 arg1 = PG_GETARG_INT64(0); - int64 arg2 = PG_GETARG_INT64(1); - int64 gcd; - int64 result; + int64 arg1 = PG_GETARG_INT64(0); + int64 arg2 = PG_GETARG_INT64(1); + int64 gcd; + int64 result; /* * Handle lcm(x, 0) = lcm(0, x) = 0 as a special case. This prevents a diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c index 8bb00abb6b..641ae3fdf8 100644 --- a/src/backend/utils/adt/json.c +++ b/src/backend/utils/adt/json.c @@ -1337,7 +1337,7 @@ json_typeof(PG_FUNCTION_ARGS) JsonLexContext *lex; JsonTokenType tok; char *type; - JsonParseErrorType result; + JsonParseErrorType result; json = PG_GETARG_TEXT_PP(0); lex = makeJsonLexContext(json, false); diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c index 9b86bdcb22..5a09d65fdc 100644 --- a/src/backend/utils/adt/jsonfuncs.c +++ b/src/backend/utils/adt/jsonfuncs.c @@ -496,7 +496,7 @@ static void transform_string_values_scalar(void *state, char *token, JsonTokenTy void pg_parse_json_or_ereport(JsonLexContext *lex, JsonSemAction *sem) { - JsonParseErrorType result; + JsonParseErrorType result; result = pg_parse_json(lex, sem); if (result != JSON_SUCCESS) @@ -4524,8 +4524,8 @@ jsonb_set_lax(PG_FUNCTION_ARGS) /* ArrayType *path = PG_GETARG_ARRAYTYPE_P(1); */ /* Jsonb *newval = PG_GETARG_JSONB_P(2); */ /* bool create = PG_GETARG_BOOL(3); */ - text *handle_null; - char *handle_val; + text *handle_null; + char *handle_val; if (PG_ARGISNULL(0) || PG_ARGISNULL(1) || PG_ARGISNULL(3)) PG_RETURN_NULL(); @@ -4537,13 +4537,13 @@ jsonb_set_lax(PG_FUNCTION_ARGS) errmsg("null_value_treatment must be \"delete_key\", \"return_target\", \"use_json_null\", or \"raise_exception\""))); /* if the new value isn't an SQL NULL just call jsonb_set */ - if (! PG_ARGISNULL(2)) + if (!PG_ARGISNULL(2)) return jsonb_set(fcinfo); handle_null = PG_GETARG_TEXT_P(4); handle_val = text_to_cstring(handle_null); - if (strcmp(handle_val,"raise_exception") == 0) + if (strcmp(handle_val, "raise_exception") == 0) { ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), @@ -4554,7 +4554,7 @@ jsonb_set_lax(PG_FUNCTION_ARGS) } else if (strcmp(handle_val, "use_json_null") == 0) { - Datum newval; + Datum newval; newval = DirectFunctionCall1(jsonb_in, CStringGetDatum("null")); @@ -4569,6 +4569,7 @@ jsonb_set_lax(PG_FUNCTION_ARGS) else if (strcmp(handle_val, "return_target") == 0) { Jsonb *in = PG_GETARG_JSONB_P(0); + PG_RETURN_JSONB_P(in); } else diff --git a/src/backend/utils/adt/numutils.c b/src/backend/utils/adt/numutils.c index a7467adb03..f4f76845a7 100644 --- a/src/backend/utils/adt/numutils.c +++ b/src/backend/utils/adt/numutils.c @@ -45,11 +45,13 @@ static inline int decimalLength32(const uint32 v) { int t; - static uint32 PowersOfTen[] = - {1, 10, 100, - 1000, 10000, 100000, - 1000000, 10000000, 100000000, - 1000000000}; + static const uint32 PowersOfTen[] = { + 1, 10, 100, + 1000, 10000, 100000, + 1000000, 10000000, 100000000, + 1000000000 + }; + /* * Compute base-10 logarithm by dividing the base-2 logarithm by a * good-enough approximation of the base-2 logarithm of 10 @@ -62,16 +64,16 @@ static inline int decimalLength64(const uint64 v) { int t; - static uint64 PowersOfTen[] = { - UINT64CONST(1), UINT64CONST(10), - UINT64CONST(100), UINT64CONST(1000), - UINT64CONST(10000), UINT64CONST(100000), - UINT64CONST(1000000), UINT64CONST(10000000), - UINT64CONST(100000000), UINT64CONST(1000000000), - UINT64CONST(10000000000), UINT64CONST(100000000000), - UINT64CONST(1000000000000), UINT64CONST(10000000000000), - UINT64CONST(100000000000000), UINT64CONST(1000000000000000), - UINT64CONST(10000000000000000), UINT64CONST(100000000000000000), + static const uint64 PowersOfTen[] = { + UINT64CONST(1), UINT64CONST(10), + UINT64CONST(100), UINT64CONST(1000), + UINT64CONST(10000), UINT64CONST(100000), + UINT64CONST(1000000), UINT64CONST(10000000), + UINT64CONST(100000000), UINT64CONST(1000000000), + UINT64CONST(10000000000), UINT64CONST(100000000000), + UINT64CONST(1000000000000), UINT64CONST(10000000000000), + UINT64CONST(100000000000000), UINT64CONST(1000000000000000), + UINT64CONST(10000000000000000), UINT64CONST(100000000000000000), UINT64CONST(1000000000000000000), UINT64CONST(10000000000000000000) }; diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c index 988b1fe902..2aff739466 100644 --- a/src/backend/utils/adt/pgstatfuncs.c +++ b/src/backend/utils/adt/pgstatfuncs.c @@ -1698,12 +1698,12 @@ Datum pg_stat_get_slru(PG_FUNCTION_ARGS) { #define PG_STAT_GET_SLRU_COLS 9 - ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo; - TupleDesc tupdesc; + ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo; + TupleDesc tupdesc; Tuplestorestate *tupstore; - MemoryContext per_query_ctx; - MemoryContext oldcontext; - int i; + MemoryContext per_query_ctx; + MemoryContext oldcontext; + int i; PgStat_SLRUStats *stats; /* check to see if caller supports us returning a tuplestore */ @@ -1733,12 +1733,12 @@ pg_stat_get_slru(PG_FUNCTION_ARGS) /* request SLRU stats from the stat collector */ stats = pgstat_fetch_slru(); - for (i = 0; ; i++) + for (i = 0;; i++) { /* for each row */ Datum values[PG_STAT_GET_SLRU_COLS]; bool nulls[PG_STAT_GET_SLRU_COLS]; - PgStat_SLRUStats stat = stats[i]; + PgStat_SLRUStats stat = stats[i]; const char *name; name = pgstat_slru_name(i); diff --git a/src/backend/utils/adt/rangetypes_spgist.c b/src/backend/utils/adt/rangetypes_spgist.c index dd2bc742aa..9bbef53149 100644 --- a/src/backend/utils/adt/rangetypes_spgist.c +++ b/src/backend/utils/adt/rangetypes_spgist.c @@ -47,11 +47,11 @@ static int16 getQuadrant(TypeCacheEntry *typcache, const RangeType *centroid, const RangeType *tst); static int bound_cmp(const void *a, const void *b, void *arg); -static int adjacent_inner_consistent(TypeCacheEntry *typcache, - const RangeBound *arg, const RangeBound *centroid, - const RangeBound *prev); -static int adjacent_cmp_bounds(TypeCacheEntry *typcache, const RangeBound *arg, - const RangeBound *centroid); +static int adjacent_inner_consistent(TypeCacheEntry *typcache, + const RangeBound *arg, const RangeBound *centroid, + const RangeBound *prev); +static int adjacent_cmp_bounds(TypeCacheEntry *typcache, const RangeBound *arg, + const RangeBound *centroid); /* * SP-GiST 'config' interface function. diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c index da8cc0cf6b..c800d797ac 100644 --- a/src/backend/utils/adt/regproc.c +++ b/src/backend/utils/adt/regproc.c @@ -1152,7 +1152,8 @@ regcollationout(PG_FUNCTION_ARGS) char *nspname; /* - * Would this collation be found by regcollationin? If not, qualify it. + * Would this collation be found by regcollationin? If not, + * qualify it. */ if (CollationIsVisible(collationid)) nspname = NULL; diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 695d8c3228..723a8fa48c 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -10611,7 +10611,7 @@ generate_opclass_name(Oid opclass) initStringInfo(&buf); get_opclass_name(opclass, InvalidOid, &buf); - return &buf.data[1]; /* get_opclass_name() prepends space */ + return &buf.data[1]; /* get_opclass_name() prepends space */ } /* @@ -11313,8 +11313,8 @@ get_reloptions(StringInfo buf, Datum reloptions) char *value; /* - * Each array element should have the form name=value. If the "=" - * is missing for some reason, treat it like an empty value. + * Each array element should have the form name=value. If the "=" is + * missing for some reason, treat it like an empty value. */ name = option; separator = strchr(option, '='); @@ -11332,11 +11332,11 @@ get_reloptions(StringInfo buf, Datum reloptions) /* * In general we need to quote the value; but to avoid unnecessary - * clutter, do not quote if it is an identifier that would not - * need quoting. (We could also allow numbers, but that is a bit - * trickier than it looks --- for example, are leading zeroes - * significant? We don't want to assume very much here about what - * custom reloptions might mean.) + * clutter, do not quote if it is an identifier that would not need + * quoting. (We could also allow numbers, but that is a bit trickier + * than it looks --- for example, are leading zeroes significant? We + * don't want to assume very much here about what custom reloptions + * might mean.) */ if (quote_identifier(value) == value) appendStringInfoString(buf, value); diff --git a/src/backend/utils/adt/tsgistidx.c b/src/backend/utils/adt/tsgistidx.c index 2e0bc3ebd0..c3f25800e7 100644 --- a/src/backend/utils/adt/tsgistidx.c +++ b/src/backend/utils/adt/tsgistidx.c @@ -307,7 +307,7 @@ checkcondition_arr(void *checkval, QueryOperand *val, ExecPhraseData *data) static bool checkcondition_bit(void *checkval, QueryOperand *val, ExecPhraseData *data) { - void *key = (SignTSVector *) checkval; + void *key = (SignTSVector *) checkval; /* * we are not able to find a prefix in signature tree @@ -499,8 +499,8 @@ hemdistsign(BITVECP a, BITVECP b, int siglen) static int hemdist(SignTSVector *a, SignTSVector *b) { - int siglena = GETSIGLEN(a); - int siglenb = GETSIGLEN(b); + int siglena = GETSIGLEN(a); + int siglenb = GETSIGLEN(b); if (ISALLTRUE(a)) { @@ -721,9 +721,9 @@ gtsvector_picksplit(PG_FUNCTION_ARGS) else size_alpha = SIGLENBIT(siglen) - sizebitvec((cache[j].allistrue) ? - GETSIGN(datum_l) : - GETSIGN(cache[j].sign), - siglen); + GETSIGN(datum_l) : + GETSIGN(cache[j].sign), + siglen); } else size_alpha = hemdistsign(cache[j].sign, GETSIGN(datum_l), siglen); diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index a7d63f107f..63d1263502 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -937,7 +937,7 @@ get_attoptions(Oid relid, int16 attnum) if (isnull) result = (Datum) 0; else - result = datumCopy(attopts, false, -1); /* text[] */ + result = datumCopy(attopts, false, -1); /* text[] */ ReleaseSysCache(tuple); @@ -3297,9 +3297,9 @@ get_index_column_opclass(Oid index_oid, int attno) bool get_index_isreplident(Oid index_oid) { - HeapTuple tuple; - Form_pg_index rd_index; - bool result; + HeapTuple tuple; + Form_pg_index rd_index; + bool result; tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(index_oid)); if (!HeapTupleIsValid(tuple)) diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 9f1f11d0c1..0b9eb00d2d 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -5318,12 +5318,12 @@ GetRelationPublicationActions(Relation relation) if (relation->rd_rel->relispartition) { /* Add publications that the ancestors are in too. */ - List *ancestors = get_partition_ancestors(RelationGetRelid(relation)); - ListCell *lc; + List *ancestors = get_partition_ancestors(RelationGetRelid(relation)); + ListCell *lc; foreach(lc, ancestors) { - Oid ancestor = lfirst_oid(lc); + Oid ancestor = lfirst_oid(lc); puboids = list_concat_unique_oid(puboids, GetRelationPublications(ancestor)); @@ -5424,13 +5424,14 @@ CopyIndexAttOptions(bytea **srcopts, int natts) * RelationGetIndexAttOptions * get AM/opclass-specific options for an index parsed into a binary form */ -bytea ** +bytea ** RelationGetIndexAttOptions(Relation relation, bool copy) { MemoryContext oldcxt; bytea **opts = relation->rd_opcoptions; Oid relid = RelationGetRelid(relation); - int natts = RelationGetNumberOfAttributes(relation); /* XXX IndexRelationGetNumberOfKeyAttributes */ + int natts = RelationGetNumberOfAttributes(relation); /* XXX + * IndexRelationGetNumberOfKeyAttributes */ int i; /* Try to copy cached options. */ diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b8858b132b..e976201030 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -403,7 +403,7 @@ matches_backtrace_functions(const char *funcname) p = backtrace_symbol_list; for (;;) { - if (*p == '\0') /* end of backtrace_symbol_list */ + if (*p == '\0') /* end of backtrace_symbol_list */ break; if (strcmp(funcname, p) == 0) @@ -845,7 +845,7 @@ errmsg(const char *fmt,...) int errbacktrace(void) { - ErrorData *edata = &errordata[errordata_stack_depth]; + ErrorData *edata = &errordata[errordata_stack_depth]; MemoryContext oldcontext; recursion_depth++; diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c index 5b4b9e487f..2688e27726 100644 --- a/src/backend/utils/hash/dynahash.c +++ b/src/backend/utils/hash/dynahash.c @@ -1719,7 +1719,10 @@ hash_corrupted(HTAB *hashp) int my_log2(long num) { - /* guard against too-large input, which would be invalid for pg_ceil_log2_*() */ + /* + * guard against too-large input, which would be invalid for + * pg_ceil_log2_*() + */ if (num > LONG_MAX / 2) num = LONG_MAX / 2; diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index 6fe25c023a..cca9704d2d 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -57,7 +57,7 @@ ProcessingMode Mode = InitProcessing; -BackendType MyBackendType; +BackendType MyBackendType; /* List of lock files to be removed at proc exit */ static List *lock_files = NIL; diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 5bdc02fce2..2f3e0a70e0 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -11718,7 +11718,7 @@ check_backtrace_functions(char **newval, void **extra, GucSource source) else if ((*newval)[i] == ' ' || (*newval)[i] == '\n' || (*newval)[i] == '\t') - ; /* ignore these */ + ; /* ignore these */ else someval[j++] = (*newval)[i]; /* copy anything else */ } diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c index dd8d7a33a4..60a761caba 100644 --- a/src/backend/utils/mmgr/aset.c +++ b/src/backend/utils/mmgr/aset.c @@ -560,7 +560,7 @@ AllocSetReset(MemoryContext context) AllocSet set = (AllocSet) context; AllocBlock block; Size keepersize PG_USED_FOR_ASSERTS_ONLY - = set->keeper->endptr - ((char *) set); + = set->keeper->endptr - ((char *) set); AssertArg(AllocSetIsValid(set)); @@ -599,7 +599,7 @@ AllocSetReset(MemoryContext context) else { /* Normal case, release the block */ - context->mem_allocated -= block->endptr - ((char*) block); + context->mem_allocated -= block->endptr - ((char *) block); #ifdef CLOBBER_FREED_MEMORY wipe_mem(block, block->freeptr - ((char *) block)); @@ -628,7 +628,7 @@ AllocSetDelete(MemoryContext context) AllocSet set = (AllocSet) context; AllocBlock block = set->blocks; Size keepersize PG_USED_FOR_ASSERTS_ONLY - = set->keeper->endptr - ((char *) set); + = set->keeper->endptr - ((char *) set); AssertArg(AllocSetIsValid(set)); @@ -1032,7 +1032,7 @@ AllocSetFree(MemoryContext context, void *pointer) if (block->next) block->next->prev = block->prev; - context->mem_allocated -= block->endptr - ((char*) block); + context->mem_allocated -= block->endptr - ((char *) block); #ifdef CLOBBER_FREED_MEMORY wipe_mem(block, block->freeptr - ((char *) block)); @@ -1124,7 +1124,7 @@ AllocSetRealloc(MemoryContext context, void *pointer, Size size) /* Do the realloc */ blksize = chksize + ALLOC_BLOCKHDRSZ + ALLOC_CHUNKHDRSZ; - oldblksize = block->endptr - ((char *)block); + oldblksize = block->endptr - ((char *) block); block = (AllocBlock) realloc(block, blksize); if (block == NULL) diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c index 9e24fec72d..abda22fa57 100644 --- a/src/backend/utils/mmgr/mcxt.c +++ b/src/backend/utils/mmgr/mcxt.c @@ -469,7 +469,7 @@ MemoryContextIsEmpty(MemoryContext context) Size MemoryContextMemAllocated(MemoryContext context, bool recurse) { - Size total = context->mem_allocated; + Size total = context->mem_allocated; AssertArg(MemoryContextIsValid(context)); diff --git a/src/backend/utils/mmgr/slab.c b/src/backend/utils/mmgr/slab.c index e9e962d767..f8d801c419 100644 --- a/src/backend/utils/mmgr/slab.c +++ b/src/backend/utils/mmgr/slab.c @@ -217,10 +217,11 @@ SlabContextCreate(MemoryContext parent, headerSize = offsetof(SlabContext, freelist) + freelistSize; #ifdef MEMORY_CONTEXT_CHECKING + /* - * With memory checking, we need to allocate extra space for the bitmap - * of free chunks. The bitmap is an array of bools, so we don't need to - * worry about alignment. + * With memory checking, we need to allocate extra space for the bitmap of + * free chunks. The bitmap is an array of bools, so we don't need to worry + * about alignment. */ headerSize += chunksPerBlock * sizeof(bool); #endif diff --git a/src/backend/utils/sort/logtape.c b/src/backend/utils/sort/logtape.c index 48ae0de305..bc8d56807e 100644 --- a/src/backend/utils/sort/logtape.c +++ b/src/backend/utils/sort/logtape.c @@ -191,8 +191,8 @@ struct LogicalTapeSet Size freeBlocksLen; /* current allocated length of freeBlocks[] */ /* The array of logical tapes. */ - int nTapes; /* # of logical tapes in set */ - LogicalTape *tapes; /* has nTapes nentries */ + int nTapes; /* # of logical tapes in set */ + LogicalTape *tapes; /* has nTapes nentries */ }; static void ltsWriteBlock(LogicalTapeSet *lts, long blocknum, void *buffer); @@ -348,9 +348,9 @@ parent_offset(unsigned long i) static long ltsGetFreeBlock(LogicalTapeSet *lts) { - long *heap = lts->freeBlocks; - long blocknum; - int heapsize; + long *heap = lts->freeBlocks; + long blocknum; + int heapsize; unsigned long pos; /* freelist empty; allocate a new block */ @@ -374,7 +374,7 @@ ltsGetFreeBlock(LogicalTapeSet *lts) heapsize = lts->nFreeBlocks; while (true) { - unsigned long left = left_offset(pos); + unsigned long left = left_offset(pos); unsigned long right = right_offset(pos); unsigned long min_child; @@ -403,7 +403,7 @@ ltsGetFreeBlock(LogicalTapeSet *lts) static void ltsReleaseBlock(LogicalTapeSet *lts, long blocknum) { - long *heap; + long *heap; unsigned long pos; /* @@ -440,6 +440,7 @@ ltsReleaseBlock(LogicalTapeSet *lts, long blocknum) while (pos != 0) { unsigned long parent = parent_offset(pos); + if (heap[parent] < heap[pos]) break; @@ -543,19 +544,19 @@ ltsConcatWorkerTapes(LogicalTapeSet *lts, TapeShare *shared, static void ltsInitTape(LogicalTape *lt) { - lt->writing = true; - lt->frozen = false; - lt->dirty = false; - lt->firstBlockNumber = -1L; - lt->curBlockNumber = -1L; - lt->nextBlockNumber = -1L; + lt->writing = true; + lt->frozen = false; + lt->dirty = false; + lt->firstBlockNumber = -1L; + lt->curBlockNumber = -1L; + lt->nextBlockNumber = -1L; lt->offsetBlockNumber = 0L; - lt->buffer = NULL; - lt->buffer_size = 0; + lt->buffer = NULL; + lt->buffer_size = 0; /* palloc() larger than MaxAllocSize would fail */ - lt->max_size = MaxAllocSize; - lt->pos = 0; - lt->nbytes = 0; + lt->max_size = MaxAllocSize; + lt->pos = 0; + lt->nbytes = 0; } /* @@ -1012,13 +1013,13 @@ LogicalTapeFreeze(LogicalTapeSet *lts, int tapenum, TapeShare *share) void LogicalTapeSetExtend(LogicalTapeSet *lts, int nAdditional) { - int i; - int nTapesOrig = lts->nTapes; + int i; + int nTapesOrig = lts->nTapes; lts->nTapes += nAdditional; - lts->tapes = (LogicalTape *) repalloc( - lts->tapes, lts->nTapes * sizeof(LogicalTape)); + lts->tapes = (LogicalTape *) repalloc(lts->tapes, + lts->nTapes * sizeof(LogicalTape)); for (i = nTapesOrig; i < lts->nTapes; i++) ltsInitTape(<s->tapes[i]); diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index d59e3d5a8d..3c49476483 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -256,8 +256,8 @@ struct Tuplesortstate bool isMaxSpaceDisk; /* true when maxSpace is value for on-disk * space, false when it's value for in-memory * space */ - TupSortStatus maxSpaceStatus; /* sort status when maxSpace was reached */ - MemoryContext maincontext; /* memory context for tuple sort metadata that + TupSortStatus maxSpaceStatus; /* sort status when maxSpace was reached */ + MemoryContext maincontext; /* memory context for tuple sort metadata that * persists across multiple batches */ MemoryContext sortcontext; /* memory context holding most sort data */ MemoryContext tuplecontext; /* sub-context of sortcontext for tuple data */ @@ -1429,11 +1429,11 @@ tuplesort_updatemax(Tuplesortstate *state) /* * Sort evicts data to the disk when it wasn't able to fit that data into - * main memory. This is why we assume space used on the disk to be - * more important for tracking resource usage than space used in memory. - * Note that the amount of space occupied by some tupleset on the disk might - * be less than amount of space occupied by the same tupleset in - * memory due to more compact representation. + * main memory. This is why we assume space used on the disk to be more + * important for tracking resource usage than space used in memory. Note + * that the amount of space occupied by some tupleset on the disk might be + * less than amount of space occupied by the same tupleset in memory due + * to more compact representation. */ if ((isSpaceDisk && !state->isMaxSpaceDisk) || (isSpaceDisk == state->isMaxSpaceDisk && spaceUsed > state->maxSpace)) |
