diff options
author | Tom Lane | 2018-04-26 18:47:16 +0000 |
---|---|---|
committer | Tom Lane | 2018-04-26 18:47:16 +0000 |
commit | bdf46af748d0f15f257c99bf06e9e25aba6a24f9 (patch) | |
tree | 3637d69ad413fdc23098cc2cf94b2cd57fd44dab /src/backend/utils | |
parent | f83bf385c1dad4964e0d899174989a1668536182 (diff) |
Post-feature-freeze pgindent run.
Discussion: https://postgr.es/m/15719.1523984266@sss.pgh.pa.us
Diffstat (limited to 'src/backend/utils')
-rw-r--r-- | src/backend/utils/adt/amutils.c | 14 | ||||
-rw-r--r-- | src/backend/utils/adt/formatting.c | 2 | ||||
-rw-r--r-- | src/backend/utils/adt/geo_spgist.c | 10 | ||||
-rw-r--r-- | src/backend/utils/adt/jsonb.c | 17 | ||||
-rw-r--r-- | src/backend/utils/adt/jsonfuncs.c | 30 | ||||
-rw-r--r-- | src/backend/utils/adt/tsquery.c | 38 | ||||
-rw-r--r-- | src/backend/utils/cache/relcache.c | 25 | ||||
-rw-r--r-- | src/backend/utils/fmgr/fmgr.c | 9 | ||||
-rw-r--r-- | src/backend/utils/misc/guc.c | 2 | ||||
-rw-r--r-- | src/backend/utils/mmgr/portalmem.c | 22 | ||||
-rw-r--r-- | src/backend/utils/sort/sharedtuplestore.c | 4 |
11 files changed, 94 insertions, 79 deletions
diff --git a/src/backend/utils/adt/amutils.c b/src/backend/utils/adt/amutils.c index 0f8ad4ef0fa..dc04148b78d 100644 --- a/src/backend/utils/adt/amutils.c +++ b/src/backend/utils/adt/amutils.c @@ -187,8 +187,8 @@ indexam_property(FunctionCallInfo fcinfo, } /* - * At this point, either index_oid == InvalidOid or it's a valid index OID. - * Also, after this test and the one below, either attno == 0 for + * At this point, either index_oid == InvalidOid or it's a valid index + * OID. Also, after this test and the one below, either attno == 0 for * index-wide or AM-wide tests, or it's a valid column number in a valid * index. */ @@ -276,6 +276,7 @@ indexam_property(FunctionCallInfo fcinfo, break; case AMPROP_ORDERABLE: + /* * generic assumption is that nonkey columns are not orderable */ @@ -293,8 +294,9 @@ indexam_property(FunctionCallInfo fcinfo, * getting there from just the index column type seems like a * lot of work. So instead we expect the AM to handle this in * its amproperty routine. The generic result is to return - * false if the AM says it never supports this, or if this is a - * nonkey column, and null otherwise (meaning we don't know). + * false if the AM says it never supports this, or if this is + * a nonkey column, and null otherwise (meaning we don't + * know). */ if (!iskey || !routine->amcanorderbyop) { @@ -314,8 +316,8 @@ indexam_property(FunctionCallInfo fcinfo, { /* * If possible, the AM should handle this test in its - * amproperty function without opening the rel. But this is the - * generic fallback if it does not. + * amproperty function without opening the rel. But this + * is the generic fallback if it does not. */ Relation indexrel = index_open(index_oid, AccessShareLock); diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 1a1088711c3..a345c656050 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -3905,7 +3905,7 @@ do_to_timestamp(text *date_txt, text *fmt, DateTimeParseError(DTERR_TZDISP_OVERFLOW, date_str, "timestamp"); tz = psprintf("%c%02d:%02d", - tmfc.tzsign > 0 ? '+' : '-', tmfc.tzh, tmfc.tzm); + tmfc.tzsign > 0 ? '+' : '-', tmfc.tzh, tmfc.tzm); tm->tm_zone = tz; } diff --git a/src/backend/utils/adt/geo_spgist.c b/src/backend/utils/adt/geo_spgist.c index 3f1a755cbb3..06411aea9ec 100644 --- a/src/backend/utils/adt/geo_spgist.c +++ b/src/backend/utils/adt/geo_spgist.c @@ -686,10 +686,10 @@ spg_box_quad_leaf_consistent(PG_FUNCTION_ARGS) /* Perform the required comparison(s) */ for (i = 0; i < in->nkeys; i++) { - StrategyNumber strategy = in->scankeys[i].sk_strategy; - BOX *box = spg_box_quad_get_scankey_bbox(&in->scankeys[i], - &out->recheck); - Datum query = BoxPGetDatum(box); + StrategyNumber strategy = in->scankeys[i].sk_strategy; + BOX *box = spg_box_quad_get_scankey_bbox(&in->scankeys[i], + &out->recheck); + Datum query = BoxPGetDatum(box); switch (strategy) { @@ -790,7 +790,7 @@ spg_bbox_quad_config(PG_FUNCTION_ARGS) Datum spg_poly_quad_compress(PG_FUNCTION_ARGS) { - POLYGON *polygon = PG_GETARG_POLYGON_P(0); + POLYGON *polygon = PG_GETARG_POLYGON_P(0); BOX *box; box = box_copy(&polygon->boundbox); diff --git a/src/backend/utils/adt/jsonb.c b/src/backend/utils/adt/jsonb.c index 80d23cc0524..e99bbc482a9 100644 --- a/src/backend/utils/adt/jsonb.c +++ b/src/backend/utils/adt/jsonb.c @@ -1861,8 +1861,8 @@ JsonbExtractScalar(JsonbContainer *jbc, JsonbValue *res) return NULL; /* - * A root scalar is stored as an array of one element, so we get the - * array and then its first (and only) member. + * A root scalar is stored as an array of one element, so we get the array + * and then its first (and only) member. */ it = JsonbIteratorInit(jbc); @@ -1871,11 +1871,11 @@ JsonbExtractScalar(JsonbContainer *jbc, JsonbValue *res) Assert(tmp.val.array.nElems == 1 && tmp.val.array.rawScalar); tok = JsonbIteratorNext(&it, res, true); - Assert (tok == WJB_ELEM); + Assert(tok == WJB_ELEM); Assert(IsAJsonbScalar(res)); tok = JsonbIteratorNext(&it, &tmp, true); - Assert (tok == WJB_END_ARRAY); + Assert(tok == WJB_END_ARRAY); tok = JsonbIteratorNext(&it, &tmp, true); Assert(tok == WJB_DONE); @@ -1912,7 +1912,8 @@ jsonb_numeric(PG_FUNCTION_ARGS) errmsg("jsonb value must be numeric"))); /* - * v.val.numeric points into jsonb body, so we need to make a copy to return + * v.val.numeric points into jsonb body, so we need to make a copy to + * return */ retValue = DatumGetNumericCopy(NumericGetDatum(v.val.numeric)); @@ -1925,7 +1926,7 @@ Datum jsonb_int2(PG_FUNCTION_ARGS) { Jsonb *in = PG_GETARG_JSONB_P(0); - JsonbValue v; + JsonbValue v; Datum retValue; if (!JsonbExtractScalar(&in->root, &v) || v.type != jbvNumeric) @@ -1945,7 +1946,7 @@ Datum jsonb_int4(PG_FUNCTION_ARGS) { Jsonb *in = PG_GETARG_JSONB_P(0); - JsonbValue v; + JsonbValue v; Datum retValue; if (!JsonbExtractScalar(&in->root, &v) || v.type != jbvNumeric) @@ -1965,7 +1966,7 @@ Datum jsonb_int8(PG_FUNCTION_ARGS) { Jsonb *in = PG_GETARG_JSONB_P(0); - JsonbValue v; + JsonbValue v; Datum retValue; if (!JsonbExtractScalar(&in->root, &v) || v.type != jbvNumeric) diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c index 202779dfffb..2f701603a26 100644 --- a/src/backend/utils/adt/jsonfuncs.c +++ b/src/backend/utils/adt/jsonfuncs.c @@ -60,7 +60,8 @@ typedef struct IterateJsonStringValuesState JsonIterateStringValuesAction action; /* an action that will be applied * to each json value */ void *action_state; /* any necessary context for iteration */ - uint32 flags; /* what kind of elements from a json we want to iterate */ + uint32 flags; /* what kind of elements from a json we want + * to iterate */ } IterateJsonStringValuesState; /* state for transform_json_string_values function */ @@ -4950,19 +4951,19 @@ setPathArray(JsonbIterator **it, Datum *path_elems, bool *path_nulls, uint32 parse_jsonb_index_flags(Jsonb *jb) { - JsonbIterator *it; - JsonbValue v; - JsonbIteratorToken type; - uint32 flags = 0; + JsonbIterator *it; + JsonbValue v; + JsonbIteratorToken type; + uint32 flags = 0; it = JsonbIteratorInit(&jb->root); type = JsonbIteratorNext(&it, &v, false); /* - * We iterate over array (scalar internally is represented as array, so, we - * will accept it too) to check all its elements. Flag names are chosen - * the same as jsonb_typeof uses. + * We iterate over array (scalar internally is represented as array, so, + * we will accept it too) to check all its elements. Flag names are + * chosen the same as jsonb_typeof uses. */ if (type != WJB_BEGIN_ARRAY) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), @@ -4977,7 +4978,7 @@ parse_jsonb_index_flags(Jsonb *jb) errhint("Possible values are: \"string\", \"numeric\", \"boolean\", \"key\" and \"all\""))); if (v.val.string.len == 3 && - pg_strncasecmp(v.val.string.val, "all", 3) == 0) + pg_strncasecmp(v.val.string.val, "all", 3) == 0) flags |= jtiAll; else if (v.val.string.len == 3 && pg_strncasecmp(v.val.string.val, "key", 3) == 0) @@ -5045,7 +5046,7 @@ iterate_jsonb_values(Jsonb *jb, uint32 flags, void *state, } /* JsonbValue is a value of object or element of array */ - switch(v.type) + switch (v.type) { case jbvString: if (flags & jtiString) @@ -5054,10 +5055,10 @@ iterate_jsonb_values(Jsonb *jb, uint32 flags, void *state, case jbvNumeric: if (flags & jtiNumeric) { - char *val; + char *val; val = DatumGetCString(DirectFunctionCall1(numeric_out, - NumericGetDatum(v.val.numeric))); + NumericGetDatum(v.val.numeric))); action(state, val, strlen(val)); pfree(val); @@ -5112,7 +5113,7 @@ iterate_values_scalar(void *state, char *token, JsonTokenType tokentype) { IterateJsonStringValuesState *_state = (IterateJsonStringValuesState *) state; - switch(tokentype) + switch (tokentype) { case JSON_TOKEN_STRING: if (_state->flags & jtiString) @@ -5140,7 +5141,8 @@ iterate_values_object_field_start(void *state, char *fname, bool isnull) if (_state->flags & jtiKey) { - char *val = pstrdup(fname); + char *val = pstrdup(fname); + _state->action(_state->action_state, val, strlen(val)); } } diff --git a/src/backend/utils/adt/tsquery.c b/src/backend/utils/adt/tsquery.c index 793c0e5dd1c..7b9dbfef0cc 100644 --- a/src/backend/utils/adt/tsquery.c +++ b/src/backend/utils/adt/tsquery.c @@ -63,9 +63,9 @@ typedef enum * *strval, *lenval and *weight are filled in when return value is PT_VAL * */ -typedef ts_tokentype (*ts_tokenizer)(TSQueryParserState state, int8 *operator, - int *lenval, char **strval, - int16 *weight, bool *prefix); +typedef ts_tokentype (*ts_tokenizer) (TSQueryParserState state, int8 *operator, + int *lenval, char **strval, + int16 *weight, bool *prefix); struct TSQueryParserStateData { @@ -233,7 +233,7 @@ parse_phrase_operator(TSQueryParserState pstate, int16 *distance) static bool parse_or_operator(TSQueryParserState pstate) { - char *ptr = pstate->buf; + char *ptr = pstate->buf; if (pstate->in_quotes) return false; @@ -245,26 +245,26 @@ parse_or_operator(TSQueryParserState pstate) ptr += 2; /* - * it shouldn't be a part of any word but somewhere later it should be some - * operand + * it shouldn't be a part of any word but somewhere later it should be + * some operand */ - if (*ptr == '\0') /* no operand */ + if (*ptr == '\0') /* no operand */ return false; /* it shouldn't be a part of any word */ - if (t_iseq(ptr, '-') || t_iseq(ptr, '_') || t_isalpha(ptr) || t_isdigit(ptr)) + if (t_iseq(ptr, '-') || t_iseq(ptr, '_') || t_isalpha(ptr) || t_isdigit(ptr)) return false; - for(;;) + for (;;) { ptr += pg_mblen(ptr); - if (*ptr == '\0') /* got end of string without operand */ + if (*ptr == '\0') /* got end of string without operand */ return false; /* - * Suppose, we found an operand, but could be a not correct operand. So - * we still treat OR literal as operation with possibly incorrect + * Suppose, we found an operand, but could be a not correct operand. + * So we still treat OR literal as operation with possibly incorrect * operand and will not search it as lexeme */ if (!t_isspace(ptr)) @@ -312,7 +312,10 @@ gettoken_query_standard(TSQueryParserState state, int8 *operator, } else if (!t_isspace(state->buf)) { - /* We rely on the tsvector parser to parse the value for us */ + /* + * We rely on the tsvector parser to parse the value for + * us + */ reset_tsvector_parser(state->valstate, state->buf); if (gettoken_tsvector(state->valstate, strval, lenval, NULL, NULL, &state->buf)) @@ -437,7 +440,10 @@ gettoken_query_websearch(TSQueryParserState state, int8 *operator, } else if (!t_isspace(state->buf)) { - /* We rely on the tsvector parser to parse the value for us */ + /* + * We rely on the tsvector parser to parse the value for + * us + */ reset_tsvector_parser(state->valstate, state->buf); if (gettoken_tsvector(state->valstate, strval, lenval, NULL, NULL, &state->buf)) @@ -464,8 +470,8 @@ gettoken_query_websearch(TSQueryParserState state, int8 *operator, if (!state->in_quotes) { /* - * put implicit AND after an operand - * and handle this quote in WAITOPERAND + * put implicit AND after an operand and handle this + * quote in WAITOPERAND */ state->state = WAITOPERAND; *operator = OP_AND; diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 22ff36714ca..3dfb1b8fbe2 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -743,7 +743,7 @@ RelationBuildRuleLock(Relation relation) ALLOCSET_SMALL_SIZES); relation->rd_rulescxt = rulescxt; MemoryContextCopyAndSetIdentifier(rulescxt, - RelationGetRelationName(relation)); + RelationGetRelationName(relation)); /* * allocate an array to hold the rewrite rules (the array is extended if @@ -1400,7 +1400,7 @@ RelationInitIndexAccessInfo(Relation relation) ALLOCSET_SMALL_SIZES); relation->rd_indexcxt = indexcxt; MemoryContextCopyAndSetIdentifier(indexcxt, - RelationGetRelationName(relation)); + RelationGetRelationName(relation)); /* * Now we can fetch the index AM's API struct @@ -4678,16 +4678,17 @@ RelationGetIndexPredicate(Relation relation) expensive, so we don't attempt it by default. * 2. "recheck_on_update" index option explicitly set by user, which overrides 1) */ -static bool IsProjectionFunctionalIndex(Relation index, IndexInfo* ii) +static bool +IsProjectionFunctionalIndex(Relation index, IndexInfo *ii) { - bool is_projection = false; + bool is_projection = false; if (ii->ii_Expressions) { - HeapTuple tuple; - Datum reloptions; - bool isnull; - QualCost index_expr_cost; + HeapTuple tuple; + Datum reloptions; + bool isnull; + QualCost index_expr_cost; /* by default functional index is considered as non-injective */ is_projection = true; @@ -4704,7 +4705,7 @@ static bool IsProjectionFunctionalIndex(Relation index, IndexInfo* ii) * inserting a new index entry for the changed value. */ if ((index_expr_cost.startup + index_expr_cost.per_tuple) > - HEURISTIC_MAX_HOT_RECHECK_EXPR_COST) + HEURISTIC_MAX_HOT_RECHECK_EXPR_COST) is_projection = false; tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(RelationGetRelid(index))); @@ -4758,7 +4759,7 @@ Bitmapset * RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind) { Bitmapset *indexattrs; /* columns used in non-projection indexes */ - Bitmapset *projindexattrs; /* columns used in projection indexes */ + Bitmapset *projindexattrs; /* columns used in projection indexes */ Bitmapset *uindexattrs; /* columns in unique indexes */ Bitmapset *pkindexattrs; /* columns in the primary index */ Bitmapset *idindexattrs; /* columns in the replica identity */ @@ -4769,7 +4770,7 @@ RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind) Oid relreplindex; ListCell *l; MemoryContext oldcxt; - int indexno; + int indexno; /* Quick exit if we already computed the result. */ if (relation->rd_indexattr != NULL) @@ -5479,7 +5480,7 @@ load_relcache_init_file(bool shared) ALLOCSET_SMALL_SIZES); rel->rd_indexcxt = indexcxt; MemoryContextCopyAndSetIdentifier(indexcxt, - RelationGetRelationName(rel)); + RelationGetRelationName(rel)); /* * Now we can fetch the index AM's API struct. (We can't store diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c index aa188bdeffa..6cbbd5b78b0 100644 --- a/src/backend/utils/fmgr/fmgr.c +++ b/src/backend/utils/fmgr/fmgr.c @@ -59,6 +59,7 @@ static void fmgr_info_other_lang(Oid functionId, FmgrInfo *finfo, HeapTuple proc static CFuncHashTabEntry *lookup_C_func(HeapTuple procedureTuple); static void record_C_func(HeapTuple procedureTuple, PGFunction user_fn, const Pg_finfo_record *inforec); + /* extern so it's callable via JIT */ extern Datum fmgr_security_definer(PG_FUNCTION_ARGS); @@ -297,7 +298,7 @@ fmgr_symbol(Oid functionId, char **mod, char **fn) !heap_attisnull(procedureTuple, Anum_pg_proc_proconfig, NULL) || FmgrHookIsNeeded(functionId)) { - *mod = NULL; /* core binary */ + *mod = NULL; /* core binary */ *fn = pstrdup("fmgr_security_definer"); ReleaseSysCache(procedureTuple); return; @@ -312,7 +313,7 @@ fmgr_symbol(Oid functionId, char **mod, char **fn) if (isnull) elog(ERROR, "null prosrc"); - *mod = NULL; /* core binary */ + *mod = NULL; /* core binary */ *fn = TextDatumGetCString(prosrcattr); break; @@ -336,13 +337,13 @@ fmgr_symbol(Oid functionId, char **mod, char **fn) break; case SQLlanguageId: - *mod = NULL; /* core binary */ + *mod = NULL; /* core binary */ *fn = pstrdup("fmgr_sql"); break; default: *mod = NULL; - *fn = NULL; /* unknown, pass pointer */ + *fn = NULL; /* unknown, pass pointer */ break; } diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 44dfa92722c..6eae3d62ccf 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -1754,6 +1754,7 @@ static struct config_bool ConfigureNamesBool[] = }, &jit_debugging_support, false, + /* * This is not guaranteed to be available, but given it's a developer * oriented option, it doesn't seem worth adding code checking @@ -1792,6 +1793,7 @@ static struct config_bool ConfigureNamesBool[] = }, &jit_profiling_support, false, + /* * This is not guaranteed to be available, but given it's a developer * oriented option, it doesn't seem worth adding code checking diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c index 53225d6f1b4..04ea32f49f2 100644 --- a/src/backend/utils/mmgr/portalmem.c +++ b/src/backend/utils/mmgr/portalmem.c @@ -108,8 +108,8 @@ EnablePortalManager(void) Assert(TopPortalContext == NULL); TopPortalContext = AllocSetContextCreate(TopMemoryContext, - "TopPortalContext", - ALLOCSET_DEFAULT_SIZES); + "TopPortalContext", + ALLOCSET_DEFAULT_SIZES); ctl.keysize = MAX_PORTALNAME_LEN; ctl.entrysize = sizeof(PortalHashEnt); @@ -630,8 +630,8 @@ static void HoldPortal(Portal portal) { /* - * Note that PersistHoldablePortal() must release all resources - * used by the portal that are local to the creating transaction. + * Note that PersistHoldablePortal() must release all resources used by + * the portal that are local to the creating transaction. */ PortalCreateHoldStore(portal); PersistHoldablePortal(portal); @@ -640,15 +640,15 @@ HoldPortal(Portal portal) PortalReleaseCachedPlan(portal); /* - * Any resources belonging to the portal will be released in the - * upcoming transaction-wide cleanup; the portal will no longer - * have its own resources. + * Any resources belonging to the portal will be released in the upcoming + * transaction-wide cleanup; the portal will no longer have its own + * resources. */ portal->resowner = NULL; /* - * Having successfully exported the holdable cursor, mark it as - * not belonging to this transaction. + * Having successfully exported the holdable cursor, mark it as not + * belonging to this transaction. */ portal->createSubid = InvalidSubTransactionId; portal->activeSubid = InvalidSubTransactionId; @@ -1240,8 +1240,8 @@ HoldPinnedPortals(void) { /* * Doing transaction control, especially abort, inside a cursor - * loop that is not read-only, for example using UPDATE - * ... RETURNING, has weird semantics issues. Also, this + * loop that is not read-only, for example using UPDATE ... + * RETURNING, has weird semantics issues. Also, this * implementation wouldn't work, because such portals cannot be * held. (The core grammar enforces that only SELECT statements * can drive a cursor, but for example PL/pgSQL does not restrict diff --git a/src/backend/utils/sort/sharedtuplestore.c b/src/backend/utils/sort/sharedtuplestore.c index 3e47fbde8e7..265c04b3d39 100644 --- a/src/backend/utils/sort/sharedtuplestore.c +++ b/src/backend/utils/sort/sharedtuplestore.c @@ -47,7 +47,7 @@ typedef struct SharedTuplestoreChunk int ntuples; /* Number of tuples in this chunk. */ int overflow; /* If overflow, how many including this one? */ char data[FLEXIBLE_ARRAY_MEMBER]; -} SharedTuplestoreChunk; +} SharedTuplestoreChunk; /* Per-participant shared state. */ typedef struct SharedTuplestoreParticipant @@ -56,7 +56,7 @@ typedef struct SharedTuplestoreParticipant BlockNumber read_page; /* Page number for next read. */ BlockNumber npages; /* Number of pages written. */ bool writing; /* Used only for assertions. */ -} SharedTuplestoreParticipant; +} SharedTuplestoreParticipant; /* The control object that lives in shared memory. */ struct SharedTuplestore |