aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2016-06-09 18:02:36 -0400
committerRobert Haas <rhaas@postgresql.org>2016-06-09 18:02:36 -0400
commit4bc424b968058c7f0aa685821d7039e86faac99c (patch)
treea4e245ae67bd11edb3926ff5fb3b0223438ac283 /contrib
parent9164deea2f4ac90ee5e008ff41fc5ad4423887b2 (diff)
downloadpostgresql-4bc424b968058c7f0aa685821d7039e86faac99c.tar.gz
postgresql-4bc424b968058c7f0aa685821d7039e86faac99c.zip
pgindent run for 9.6
Diffstat (limited to 'contrib')
-rw-r--r--contrib/auto_explain/auto_explain.c26
-rw-r--r--contrib/bloom/blinsert.c10
-rw-r--r--contrib/bloom/bloom.h39
-rw-r--r--contrib/bloom/blutils.c5
-rw-r--r--contrib/bloom/blvacuum.c8
-rw-r--r--contrib/file_fdw/file_fdw.c8
-rw-r--r--contrib/isn/isn.c6
-rw-r--r--contrib/pageinspect/heapfuncs.c71
-rw-r--r--contrib/pg_trgm/trgm_gin.c17
-rw-r--r--contrib/pg_trgm/trgm_gist.c3
-rw-r--r--contrib/pg_trgm/trgm_op.c123
-rw-r--r--contrib/pg_visibility/pg_visibility.c24
-rw-r--r--contrib/pgcrypto/pgp.h2
-rw-r--r--contrib/postgres_fdw/connection.c24
-rw-r--r--contrib/postgres_fdw/deparse.c16
-rw-r--r--contrib/postgres_fdw/option.c4
-rw-r--r--contrib/postgres_fdw/postgres_fdw.c21
-rw-r--r--contrib/postgres_fdw/postgres_fdw.h26
-rw-r--r--contrib/sslinfo/sslinfo.c4
-rw-r--r--contrib/test_decoding/test_decoding.c6
20 files changed, 228 insertions, 215 deletions
diff --git a/contrib/auto_explain/auto_explain.c b/contrib/auto_explain/auto_explain.c
index fcd11a00713..4ccd2aa8490 100644
--- a/contrib/auto_explain/auto_explain.c
+++ b/contrib/auto_explain/auto_explain.c
@@ -165,16 +165,16 @@ _PG_init(void)
DefineCustomRealVariable("auto_explain.sample_rate",
"Fraction of queries to process.",
- NULL,
- &auto_explain_sample_rate,
- 1.0,
- 0.0,
- 1.0,
- PGC_SUSET,
- 0,
- NULL,
- NULL,
- NULL);
+ NULL,
+ &auto_explain_sample_rate,
+ 1.0,
+ 0.0,
+ 1.0,
+ PGC_SUSET,
+ 0,
+ NULL,
+ NULL,
+ NULL);
EmitWarningsOnPlaceholders("auto_explain");
@@ -209,12 +209,12 @@ static void
explain_ExecutorStart(QueryDesc *queryDesc, int eflags)
{
/*
- * For rate sampling, randomly choose top-level statement. Either
- * all nested statements will be explained or none will.
+ * For rate sampling, randomly choose top-level statement. Either all
+ * nested statements will be explained or none will.
*/
if (auto_explain_log_min_duration >= 0 && nesting_level == 0)
current_query_sampled = (random() < auto_explain_sample_rate *
- MAX_RANDOM_VALUE);
+ MAX_RANDOM_VALUE);
if (auto_explain_enabled() && current_query_sampled)
{
diff --git a/contrib/bloom/blinsert.c b/contrib/bloom/blinsert.c
index 15ac30d55f6..3953af996bb 100644
--- a/contrib/bloom/blinsert.c
+++ b/contrib/bloom/blinsert.c
@@ -33,11 +33,11 @@ PG_MODULE_MAGIC;
typedef struct
{
BloomState blstate; /* bloom index state */
- MemoryContext tmpCtx; /* temporary memory context reset after
- * each tuple */
+ MemoryContext tmpCtx; /* temporary memory context reset after each
+ * tuple */
char data[BLCKSZ]; /* cached page */
int64 count; /* number of tuples in cached page */
-} BloomBuildState;
+} BloomBuildState;
/*
* Flush page cached in BloomBuildState.
@@ -140,8 +140,8 @@ blbuild(Relation heap, Relation index, IndexInfo *indexInfo)
bloomBuildCallback, (void *) &buildstate);
/*
- * There are could be some items in cached page. Flush this page
- * if needed.
+ * There are could be some items in cached page. Flush this page if
+ * needed.
*/
if (buildstate.count > 0)
flushCachedPage(index, &buildstate);
diff --git a/contrib/bloom/bloom.h b/contrib/bloom/bloom.h
index c6091a8dd66..bc451a00dbe 100644
--- a/contrib/bloom/bloom.h
+++ b/contrib/bloom/bloom.h
@@ -31,14 +31,13 @@
/* Opaque for bloom pages */
typedef struct BloomPageOpaqueData
{
- OffsetNumber maxoff; /* number of index tuples on page */
- uint16 flags; /* see bit definitions below */
- uint16 unused; /* placeholder to force maxaligning of size
- * of BloomPageOpaqueData and to place
- * bloom_page_id exactly at the end of page
- */
- uint16 bloom_page_id; /* for identification of BLOOM indexes */
-} BloomPageOpaqueData;
+ OffsetNumber maxoff; /* number of index tuples on page */
+ uint16 flags; /* see bit definitions below */
+ uint16 unused; /* placeholder to force maxaligning of size of
+ * BloomPageOpaqueData and to place
+ * bloom_page_id exactly at the end of page */
+ uint16 bloom_page_id; /* for identification of BLOOM indexes */
+} BloomPageOpaqueData;
typedef BloomPageOpaqueData *BloomPageOpaque;
@@ -102,9 +101,9 @@ typedef struct BloomOptions
{
int32 vl_len_; /* varlena header (do not touch directly!) */
int bloomLength; /* length of signature in words (not bits!) */
- int bitSize[INDEX_MAX_KEYS]; /* # of bits generated for each
- * index key */
-} BloomOptions;
+ int bitSize[INDEX_MAX_KEYS]; /* # of bits generated for
+ * each index key */
+} BloomOptions;
/*
* FreeBlockNumberArray - array of block numbers sized so that metadata fill
@@ -125,7 +124,7 @@ typedef struct BloomMetaPageData
uint16 nEnd;
BloomOptions opts;
FreeBlockNumberArray notFullPage;
-} BloomMetaPageData;
+} BloomMetaPageData;
/* Magic number to distinguish bloom pages among anothers */
#define BLOOM_MAGICK_NUMBER (0xDBAC0DED)
@@ -146,7 +145,7 @@ typedef struct BloomState
* precompute it
*/
Size sizeOfBloomTuple;
-} BloomState;
+} BloomState;
#define BloomPageGetFreeSpace(state, page) \
(BLCKSZ - MAXALIGN(SizeOfPageHeaderData) \
@@ -160,30 +159,30 @@ typedef struct BloomTuple
{
ItemPointerData heapPtr;
BloomSignatureWord sign[FLEXIBLE_ARRAY_MEMBER];
-} BloomTuple;
+} BloomTuple;
#define BLOOMTUPLEHDRSZ offsetof(BloomTuple, sign)
/* Opaque data structure for bloom index scan */
typedef struct BloomScanOpaqueData
{
- BloomSignatureWord *sign; /* Scan signature */
+ BloomSignatureWord *sign; /* Scan signature */
BloomState state;
-} BloomScanOpaqueData;
+} BloomScanOpaqueData;
typedef BloomScanOpaqueData *BloomScanOpaque;
/* blutils.c */
extern void _PG_init(void);
extern Datum blhandler(PG_FUNCTION_ARGS);
-extern void initBloomState(BloomState * state, Relation index);
+extern void initBloomState(BloomState *state, Relation index);
extern void BloomFillMetapage(Relation index, Page metaPage);
extern void BloomInitMetapage(Relation index);
extern void BloomInitPage(Page page, uint16 flags);
extern Buffer BloomNewBuffer(Relation index);
-extern void signValue(BloomState * state, BloomSignatureWord * sign, Datum value, int attno);
-extern BloomTuple *BloomFormTuple(BloomState * state, ItemPointer iptr, Datum *values, bool *isnull);
-extern bool BloomPageAddItem(BloomState * state, Page page, BloomTuple * tuple);
+extern void signValue(BloomState *state, BloomSignatureWord *sign, Datum value, int attno);
+extern BloomTuple *BloomFormTuple(BloomState *state, ItemPointer iptr, Datum *values, bool *isnull);
+extern bool BloomPageAddItem(BloomState *state, Page page, BloomTuple *tuple);
/* blvalidate.c */
extern bool blvalidate(Oid opclassoid);
diff --git a/contrib/bloom/blutils.c b/contrib/bloom/blutils.c
index 876952f2d5f..317bcb3dec1 100644
--- a/contrib/bloom/blutils.c
+++ b/contrib/bloom/blutils.c
@@ -37,6 +37,7 @@ PG_FUNCTION_INFO_V1(blhandler);
/* Kind of relation options for bloom index */
static relopt_kind bl_relopt_kind;
+
/* parse table for fillRelOptions */
static relopt_parse_elt bl_relopt_tab[INDEX_MAX_KEYS + 1];
@@ -215,7 +216,9 @@ myRand(void)
* October 1988, p. 1195.
*----------
*/
- int32 hi, lo, x;
+ int32 hi,
+ lo,
+ x;
/* Must be in [1, 0x7ffffffe] range at this point. */
hi = next / 127773;
diff --git a/contrib/bloom/blvacuum.c b/contrib/bloom/blvacuum.c
index 5ae33499386..7c355463a28 100644
--- a/contrib/bloom/blvacuum.c
+++ b/contrib/bloom/blvacuum.c
@@ -78,7 +78,7 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
/* Iterate over the tuples */
itup = itupPtr = BloomPageGetTuple(&state, page, FirstOffsetNumber);
itupEnd = BloomPageGetTuple(&state, page,
- OffsetNumberNext(BloomPageGetMaxOffset(page)));
+ OffsetNumberNext(BloomPageGetMaxOffset(page)));
while (itup < itupEnd)
{
/* Do we have to delete this tuple? */
@@ -106,11 +106,11 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
}
Assert(itupPtr == BloomPageGetTuple(&state, page,
- OffsetNumberNext(BloomPageGetMaxOffset(page))));
+ OffsetNumberNext(BloomPageGetMaxOffset(page))));
/*
- * Add page to notFullPage list if we will not mark page as deleted and
- * there is a free space on it
+ * Add page to notFullPage list if we will not mark page as deleted
+ * and there is a free space on it
*/
if (BloomPageGetMaxOffset(page) != 0 &&
BloomPageGetFreeSpace(&state, page) > state.sizeOfBloomTuple &&
diff --git a/contrib/file_fdw/file_fdw.c b/contrib/file_fdw/file_fdw.c
index bc4d2d70824..c0491318c0b 100644
--- a/contrib/file_fdw/file_fdw.c
+++ b/contrib/file_fdw/file_fdw.c
@@ -132,7 +132,7 @@ static bool fileAnalyzeForeignTable(Relation relation,
AcquireSampleRowsFunc *func,
BlockNumber *totalpages);
static bool fileIsForeignScanParallelSafe(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
/*
* Helper functions
@@ -767,12 +767,12 @@ fileAnalyzeForeignTable(Relation relation,
/*
* fileIsForeignScanParallelSafe
- * Reading a file in a parallel worker should work just the same as
- * reading it in the leader, so mark scans safe.
+ * Reading a file in a parallel worker should work just the same as
+ * reading it in the leader, so mark scans safe.
*/
static bool
fileIsForeignScanParallelSafe(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte)
+ RangeTblEntry *rte)
{
return true;
}
diff --git a/contrib/isn/isn.c b/contrib/isn/isn.c
index 49d088ffa88..c622a4ef07f 100644
--- a/contrib/isn/isn.c
+++ b/contrib/isn/isn.c
@@ -444,9 +444,9 @@ ean2ISBN(char *isn)
unsigned check;
/*
- * The number should come in this format: 978-0-000-00000-0
- * or may be an ISBN-13 number, 979-..., which does not have a short
- * representation. Do the short output version if possible.
+ * The number should come in this format: 978-0-000-00000-0 or may be an
+ * ISBN-13 number, 979-..., which does not have a short representation. Do
+ * the short output version if possible.
*/
if (strncmp("978-", isn, 4) == 0)
{
diff --git a/contrib/pageinspect/heapfuncs.c b/contrib/pageinspect/heapfuncs.c
index d0c28865c3f..904eaef2dab 100644
--- a/contrib/pageinspect/heapfuncs.c
+++ b/contrib/pageinspect/heapfuncs.c
@@ -82,7 +82,7 @@ text_to_bits(char *str, int len)
else
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("illegal character '%c' in t_bits string", str[off])));
+ errmsg("illegal character '%c' in t_bits string", str[off])));
if (off % 8 == 7)
bits[off / 8] = byte;
@@ -192,9 +192,9 @@ heap_page_items(PG_FUNCTION_ARGS)
lp_offset == MAXALIGN(lp_offset) &&
lp_offset + lp_len <= raw_page_size)
{
- HeapTupleHeader tuphdr;
- bytea *tuple_data_bytea;
- int tuple_data_len;
+ HeapTupleHeader tuphdr;
+ bytea *tuple_data_bytea;
+ int tuple_data_len;
/* Extract information from the tuple header */
@@ -214,7 +214,7 @@ heap_page_items(PG_FUNCTION_ARGS)
tuple_data_bytea = (bytea *) palloc(tuple_data_len + VARHDRSZ);
SET_VARSIZE(tuple_data_bytea, tuple_data_len + VARHDRSZ);
memcpy(VARDATA(tuple_data_bytea), (char *) tuphdr + tuphdr->t_hoff,
- tuple_data_len);
+ tuple_data_len);
values[13] = PointerGetDatum(tuple_data_bytea);
/*
@@ -284,16 +284,16 @@ heap_page_items(PG_FUNCTION_ARGS)
*/
static Datum
tuple_data_split_internal(Oid relid, char *tupdata,
- uint16 tupdata_len, uint16 t_infomask,
- uint16 t_infomask2, bits8 *t_bits,
- bool do_detoast)
+ uint16 tupdata_len, uint16 t_infomask,
+ uint16 t_infomask2, bits8 *t_bits,
+ bool do_detoast)
{
- ArrayBuildState *raw_attrs;
- int nattrs;
- int i;
- int off = 0;
- Relation rel;
- TupleDesc tupdesc;
+ ArrayBuildState *raw_attrs;
+ int nattrs;
+ int i;
+ int off = 0;
+ Relation rel;
+ TupleDesc tupdesc;
/* Get tuple descriptor from relation OID */
rel = relation_open(relid, NoLock);
@@ -310,30 +310,31 @@ tuple_data_split_internal(Oid relid, char *tupdata,
for (i = 0; i < nattrs; i++)
{
- Form_pg_attribute attr;
- bool is_null;
- bytea *attr_data = NULL;
+ Form_pg_attribute attr;
+ bool is_null;
+ bytea *attr_data = NULL;
attr = tupdesc->attrs[i];
is_null = (t_infomask & HEAP_HASNULL) && att_isnull(i, t_bits);
/*
- * Tuple header can specify less attributes than tuple descriptor
- * as ALTER TABLE ADD COLUMN without DEFAULT keyword does not
- * actually change tuples in pages, so attributes with numbers greater
- * than (t_infomask2 & HEAP_NATTS_MASK) should be treated as NULL.
+ * Tuple header can specify less attributes than tuple descriptor as
+ * ALTER TABLE ADD COLUMN without DEFAULT keyword does not actually
+ * change tuples in pages, so attributes with numbers greater than
+ * (t_infomask2 & HEAP_NATTS_MASK) should be treated as NULL.
*/
if (i >= (t_infomask2 & HEAP_NATTS_MASK))
is_null = true;
if (!is_null)
{
- int len;
+ int len;
if (attr->attlen == -1)
{
off = att_align_pointer(off, tupdesc->attrs[i]->attalign, -1,
tupdata + off);
+
/*
* As VARSIZE_ANY throws an exception if it can't properly
* detect the type of external storage in macros VARTAG_SIZE,
@@ -343,8 +344,8 @@ tuple_data_split_internal(Oid relid, char *tupdata,
!VARATT_IS_EXTERNAL_ONDISK(tupdata + off) &&
!VARATT_IS_EXTERNAL_INDIRECT(tupdata + off))
ereport(ERROR,
- (errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("first byte of varlena attribute is incorrect for attribute %d", i)));
+ (errcode(ERRCODE_DATA_CORRUPTED),
+ errmsg("first byte of varlena attribute is incorrect for attribute %d", i)));
len = VARSIZE_ANY(tupdata + off);
}
@@ -381,7 +382,7 @@ tuple_data_split_internal(Oid relid, char *tupdata,
if (tupdata_len != off)
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("end of tuple reached without looking at all its data")));
+ errmsg("end of tuple reached without looking at all its data")));
return makeArrayResult(raw_attrs, CurrentMemoryContext);
}
@@ -397,14 +398,14 @@ PG_FUNCTION_INFO_V1(tuple_data_split);
Datum
tuple_data_split(PG_FUNCTION_ARGS)
{
- Oid relid;
- bytea *raw_data;
- uint16 t_infomask;
- uint16 t_infomask2;
- char *t_bits_str;
- bool do_detoast = false;
- bits8 *t_bits = NULL;
- Datum res;
+ Oid relid;
+ bytea *raw_data;
+ uint16 t_infomask;
+ uint16 t_infomask2;
+ char *t_bits_str;
+ bool do_detoast = false;
+ bits8 *t_bits = NULL;
+ Datum res;
relid = PG_GETARG_OID(0);
raw_data = PG_ARGISNULL(1) ? NULL : PG_GETARG_BYTEA_P(1);
@@ -430,8 +431,8 @@ tuple_data_split(PG_FUNCTION_ARGS)
*/
if (t_infomask & HEAP_HASNULL)
{
- int bits_str_len;
- int bits_len;
+ int bits_str_len;
+ int bits_len;
bits_len = (t_infomask2 & HEAP_NATTS_MASK) / 8 + 1;
if (!t_bits_str)
diff --git a/contrib/pg_trgm/trgm_gin.c b/contrib/pg_trgm/trgm_gin.c
index 8c190415910..ead33ef5447 100644
--- a/contrib/pg_trgm/trgm_gin.c
+++ b/contrib/pg_trgm/trgm_gin.c
@@ -265,13 +265,13 @@ gin_trgm_consistent(PG_FUNCTION_ARGS)
Datum
gin_trgm_triconsistent(PG_FUNCTION_ARGS)
{
- GinTernaryValue *check = (GinTernaryValue *) PG_GETARG_POINTER(0);
+ GinTernaryValue *check = (GinTernaryValue *) PG_GETARG_POINTER(0);
StrategyNumber strategy = PG_GETARG_UINT16(1);
/* text *query = PG_GETARG_TEXT_P(2); */
int32 nkeys = PG_GETARG_INT32(3);
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
- GinTernaryValue res = GIN_MAYBE;
+ GinTernaryValue res = GIN_MAYBE;
int32 i,
ntrue;
bool *boolcheck;
@@ -293,11 +293,12 @@ gin_trgm_triconsistent(PG_FUNCTION_ARGS)
}
/*
- * See comment in gin_trgm_consistent() about * upper bound formula
+ * See comment in gin_trgm_consistent() about * upper bound
+ * formula
*/
res = (nkeys == 0)
? GIN_FALSE : (((((float4) ntrue) / ((float4) nkeys)) >= nlimit)
- ? GIN_MAYBE : GIN_FALSE);
+ ? GIN_MAYBE : GIN_FALSE);
break;
case ILikeStrategyNumber:
#ifndef IGNORECASE
@@ -330,9 +331,9 @@ gin_trgm_triconsistent(PG_FUNCTION_ARGS)
else
{
/*
- * As trigramsMatchGraph implements a monotonic boolean function,
- * promoting all GIN_MAYBE keys to GIN_TRUE will give a
- * conservative result.
+ * As trigramsMatchGraph implements a monotonic boolean
+ * function, promoting all GIN_MAYBE keys to GIN_TRUE will
+ * give a conservative result.
*/
boolcheck = (bool *) palloc(sizeof(bool) * nkeys);
for (i = 0; i < nkeys; i++)
@@ -345,7 +346,7 @@ gin_trgm_triconsistent(PG_FUNCTION_ARGS)
break;
default:
elog(ERROR, "unrecognized strategy number: %d", strategy);
- res = GIN_FALSE; /* keep compiler quiet */
+ res = GIN_FALSE; /* keep compiler quiet */
break;
}
diff --git a/contrib/pg_trgm/trgm_gist.c b/contrib/pg_trgm/trgm_gist.c
index 2181c2623fa..3a5aff9edee 100644
--- a/contrib/pg_trgm/trgm_gist.c
+++ b/contrib/pg_trgm/trgm_gist.c
@@ -296,6 +296,7 @@ gtrgm_consistent(PG_FUNCTION_ARGS)
if (GIST_LEAF(entry))
{ /* all leafs contains orig trgm */
+
/*
* Prevent gcc optimizing the tmpsml variable using volatile
* keyword. Otherwise comparison of nlimit and tmpsml may give
@@ -476,12 +477,14 @@ gtrgm_distance(PG_FUNCTION_ARGS)
*recheck = strategy == WordDistanceStrategyNumber;
if (GIST_LEAF(entry))
{ /* all leafs contains orig trgm */
+
/*
* Prevent gcc optimizing the sml variable using volatile
* keyword. Otherwise res can differ from the
* word_similarity_dist_op() function.
*/
float4 volatile sml = cnt_sml(qtrg, key, *recheck);
+
res = 1.0 - sml;
}
else if (ISALLTRUE(key))
diff --git a/contrib/pg_trgm/trgm_op.c b/contrib/pg_trgm/trgm_op.c
index b728cc1abd3..dd0f492cfab 100644
--- a/contrib/pg_trgm/trgm_op.c
+++ b/contrib/pg_trgm/trgm_op.c
@@ -16,8 +16,8 @@
PG_MODULE_MAGIC;
/* GUC variables */
-double similarity_threshold = 0.3f;
-double word_similarity_threshold = 0.6f;
+double similarity_threshold = 0.3f;
+double word_similarity_threshold = 0.6f;
void _PG_init(void);
@@ -36,8 +36,8 @@ PG_FUNCTION_INFO_V1(word_similarity_dist_commutator_op);
/* Trigram with position */
typedef struct
{
- trgm trg;
- int index;
+ trgm trg;
+ int index;
} pos_trgm;
/*
@@ -48,29 +48,29 @@ _PG_init(void)
{
/* Define custom GUC variables. */
DefineCustomRealVariable("pg_trgm.similarity_threshold",
- "Sets the threshold used by the %% operator.",
- "Valid range is 0.0 .. 1.0.",
- &similarity_threshold,
- 0.3,
- 0.0,
- 1.0,
- PGC_USERSET,
- 0,
- NULL,
- NULL,
- NULL);
+ "Sets the threshold used by the %% operator.",
+ "Valid range is 0.0 .. 1.0.",
+ &similarity_threshold,
+ 0.3,
+ 0.0,
+ 1.0,
+ PGC_USERSET,
+ 0,
+ NULL,
+ NULL,
+ NULL);
DefineCustomRealVariable("pg_trgm.word_similarity_threshold",
- "Sets the threshold used by the <%% operator.",
- "Valid range is 0.0 .. 1.0.",
- &word_similarity_threshold,
- 0.6,
- 0.0,
- 1.0,
- PGC_USERSET,
- 0,
- NULL,
- NULL,
- NULL);
+ "Sets the threshold used by the <%% operator.",
+ "Valid range is 0.0 .. 1.0.",
+ &word_similarity_threshold,
+ 0.6,
+ 0.0,
+ 1.0,
+ PGC_USERSET,
+ 0,
+ NULL,
+ NULL,
+ NULL);
}
/*
@@ -352,9 +352,9 @@ generate_trgm(char *str, int slen)
* Make array of positional trigrams from two trigram arrays trg1 and trg2.
*
* trg1: trigram array of search pattern, of length len1. trg1 is required
- * word which positions don't matter and replaced with -1.
+ * word which positions don't matter and replaced with -1.
* trg2: trigram array of text, of length len2. trg2 is haystack where we
- * search and have to store its positions.
+ * search and have to store its positions.
*
* Returns concatenated trigram array.
*/
@@ -362,7 +362,8 @@ static pos_trgm *
make_positional_trgm(trgm *trg1, int len1, trgm *trg2, int len2)
{
pos_trgm *result;
- int i, len = len1 + len2;
+ int i,
+ len = len1 + len2;
result = (pos_trgm *) palloc(sizeof(pos_trgm) * len);
@@ -387,9 +388,9 @@ make_positional_trgm(trgm *trg1, int len1, trgm *trg2, int len2)
static int
comp_ptrgm(const void *v1, const void *v2)
{
- const pos_trgm *p1 = (const pos_trgm *)v1;
- const pos_trgm *p2 = (const pos_trgm *)v2;
- int cmp;
+ const pos_trgm *p1 = (const pos_trgm *) v1;
+ const pos_trgm *p2 = (const pos_trgm *) v2;
+ int cmp;
cmp = CMPTRGM(p1->trg, p2->trg);
if (cmp != 0)
@@ -413,7 +414,7 @@ comp_ptrgm(const void *v1, const void *v2)
* len2: length of array "trg2" and array "trg2indexes".
* len: length of the array "found".
* check_only: if true then only check existaince of similar search pattern in
- * text.
+ * text.
*
* Returns word similarity.
*/
@@ -441,7 +442,7 @@ iterate_word_similarity(int *trg2indexes,
for (i = 0; i < len2; i++)
{
/* Get index of next trigram */
- int trgindex = trg2indexes[i];
+ int trgindex = trg2indexes[i];
/* Update last position of this trigram */
if (lower >= 0 || found[trgindex])
@@ -458,10 +459,10 @@ iterate_word_similarity(int *trg2indexes,
/* Adjust lower bound if this trigram is present in required substing */
if (found[trgindex])
{
- int prev_lower,
- tmp_ulen2,
- tmp_lower,
- tmp_count;
+ int prev_lower,
+ tmp_ulen2,
+ tmp_lower,
+ tmp_count;
upper = i;
if (lower == -1)
@@ -478,8 +479,8 @@ iterate_word_similarity(int *trg2indexes,
prev_lower = lower;
for (tmp_lower = lower; tmp_lower <= upper; tmp_lower++)
{
- float smlr_tmp = CALCSML(tmp_count, ulen1, tmp_ulen2);
- int tmp_trgindex;
+ float smlr_tmp = CALCSML(tmp_count, ulen1, tmp_ulen2);
+ int tmp_trgindex;
if (smlr_tmp > smlr_cur)
{
@@ -488,10 +489,11 @@ iterate_word_similarity(int *trg2indexes,
lower = tmp_lower;
count = tmp_count;
}
+
/*
* if we only check that word similarity is greater than
- * pg_trgm.word_similarity_threshold we do not need to calculate
- * a maximum similarity.
+ * pg_trgm.word_similarity_threshold we do not need to
+ * calculate a maximum similarity.
*/
if (check_only && smlr_cur >= word_similarity_threshold)
break;
@@ -506,6 +508,7 @@ iterate_word_similarity(int *trg2indexes,
}
smlr_max = Max(smlr_max, smlr_cur);
+
/*
* if we only check that word similarity is greater than
* pg_trgm.word_similarity_threshold we do not need to calculate a
@@ -516,7 +519,8 @@ iterate_word_similarity(int *trg2indexes,
for (tmp_lower = prev_lower; tmp_lower < lower; tmp_lower++)
{
- int tmp_trgindex;
+ int tmp_trgindex;
+
tmp_trgindex = trg2indexes[tmp_lower];
if (lastpos[tmp_trgindex] == tmp_lower)
lastpos[tmp_trgindex] = -1;
@@ -544,13 +548,13 @@ iterate_word_similarity(int *trg2indexes,
* str1: search pattern string, of length slen1 bytes.
* str2: text in which we are looking for a word, of length slen2 bytes.
* check_only: if true then only check existaince of similar search pattern in
- * text.
+ * text.
*
* Returns word similarity.
*/
static float4
calc_word_similarity(char *str1, int slen1, char *str2, int slen2,
- bool check_only)
+ bool check_only)
{
bool *found;
pos_trgm *ptrg;
@@ -568,8 +572,8 @@ calc_word_similarity(char *str1, int slen1, char *str2, int slen2,
protect_out_of_mem(slen1 + slen2);
/* Make positional trigrams */
- trg1 = (trgm *) palloc(sizeof(trgm) * (slen1 / 2 + 1) * 3);
- trg2 = (trgm *) palloc(sizeof(trgm) * (slen2 / 2 + 1) * 3);
+ trg1 = (trgm *) palloc(sizeof(trgm) * (slen1 / 2 + 1) *3);
+ trg2 = (trgm *) palloc(sizeof(trgm) * (slen2 / 2 + 1) *3);
len1 = generate_trgm_only(trg1, str1, slen1);
len2 = generate_trgm_only(trg2, str2, slen2);
@@ -594,7 +598,8 @@ calc_word_similarity(char *str1, int slen1, char *str2, int slen2,
{
if (i > 0)
{
- int cmp = CMPTRGM(ptrg[i - 1].trg, ptrg[i].trg);
+ int cmp = CMPTRGM(ptrg[i - 1].trg, ptrg[i].trg);
+
if (cmp != 0)
{
if (found[j])
@@ -617,7 +622,7 @@ calc_word_similarity(char *str1, int slen1, char *str2, int slen2,
/* Run iterative procedure to find maximum similarity with word */
result = iterate_word_similarity(trg2indexes, found, ulen1, len2, len,
- check_only);
+ check_only);
pfree(trg2indexes);
pfree(found);
@@ -1075,8 +1080,8 @@ word_similarity(PG_FUNCTION_ARGS)
float4 res;
res = calc_word_similarity(VARDATA_ANY(in1), VARSIZE_ANY_EXHDR(in1),
- VARDATA_ANY(in2), VARSIZE_ANY_EXHDR(in2),
- false);
+ VARDATA_ANY(in2), VARSIZE_ANY_EXHDR(in2),
+ false);
PG_FREE_IF_COPY(in1, 0);
PG_FREE_IF_COPY(in2, 1);
@@ -1111,8 +1116,8 @@ word_similarity_op(PG_FUNCTION_ARGS)
float4 res;
res = calc_word_similarity(VARDATA_ANY(in1), VARSIZE_ANY_EXHDR(in1),
- VARDATA_ANY(in2), VARSIZE_ANY_EXHDR(in2),
- true);
+ VARDATA_ANY(in2), VARSIZE_ANY_EXHDR(in2),
+ true);
PG_FREE_IF_COPY(in1, 0);
PG_FREE_IF_COPY(in2, 1);
@@ -1127,8 +1132,8 @@ word_similarity_commutator_op(PG_FUNCTION_ARGS)
float4 res;
res = calc_word_similarity(VARDATA_ANY(in2), VARSIZE_ANY_EXHDR(in2),
- VARDATA_ANY(in1), VARSIZE_ANY_EXHDR(in1),
- true);
+ VARDATA_ANY(in1), VARSIZE_ANY_EXHDR(in1),
+ true);
PG_FREE_IF_COPY(in1, 0);
PG_FREE_IF_COPY(in2, 1);
@@ -1143,8 +1148,8 @@ word_similarity_dist_op(PG_FUNCTION_ARGS)
float4 res;
res = calc_word_similarity(VARDATA_ANY(in1), VARSIZE_ANY_EXHDR(in1),
- VARDATA_ANY(in2), VARSIZE_ANY_EXHDR(in2),
- false);
+ VARDATA_ANY(in2), VARSIZE_ANY_EXHDR(in2),
+ false);
PG_FREE_IF_COPY(in1, 0);
PG_FREE_IF_COPY(in2, 1);
@@ -1159,8 +1164,8 @@ word_similarity_dist_commutator_op(PG_FUNCTION_ARGS)
float4 res;
res = calc_word_similarity(VARDATA_ANY(in2), VARSIZE_ANY_EXHDR(in2),
- VARDATA_ANY(in1), VARSIZE_ANY_EXHDR(in1),
- false);
+ VARDATA_ANY(in1), VARSIZE_ANY_EXHDR(in1),
+ false);
PG_FREE_IF_COPY(in1, 0);
PG_FREE_IF_COPY(in2, 1);
diff --git a/contrib/pg_visibility/pg_visibility.c b/contrib/pg_visibility/pg_visibility.c
index 5e5c7cce244..9edf239819c 100644
--- a/contrib/pg_visibility/pg_visibility.c
+++ b/contrib/pg_visibility/pg_visibility.c
@@ -20,8 +20,8 @@ PG_MODULE_MAGIC;
typedef struct vbits
{
- BlockNumber next;
- BlockNumber count;
+ BlockNumber next;
+ BlockNumber count;
uint8 bits[FLEXIBLE_ARRAY_MEMBER];
} vbits;
@@ -129,7 +129,7 @@ pg_visibility_map_rel(PG_FUNCTION_ARGS)
if (SRF_IS_FIRSTCALL())
{
Oid relid = PG_GETARG_OID(0);
- MemoryContext oldcontext;
+ MemoryContext oldcontext;
funcctx = SRF_FIRSTCALL_INIT();
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
@@ -173,7 +173,7 @@ pg_visibility_rel(PG_FUNCTION_ARGS)
if (SRF_IS_FIRSTCALL())
{
Oid relid = PG_GETARG_OID(0);
- MemoryContext oldcontext;
+ MemoryContext oldcontext;
funcctx = SRF_FIRSTCALL_INIT();
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
@@ -214,8 +214,8 @@ pg_visibility_map_summary(PG_FUNCTION_ARGS)
{
Oid relid = PG_GETARG_OID(0);
Relation rel;
- BlockNumber nblocks;
- BlockNumber blkno;
+ BlockNumber nblocks;
+ BlockNumber blkno;
Buffer vmbuffer = InvalidBuffer;
int64 all_visible = 0;
int64 all_frozen = 0;
@@ -292,16 +292,16 @@ static vbits *
collect_visibility_data(Oid relid, bool include_pd)
{
Relation rel;
- BlockNumber nblocks;
+ BlockNumber nblocks;
vbits *info;
- BlockNumber blkno;
+ BlockNumber blkno;
Buffer vmbuffer = InvalidBuffer;
- BufferAccessStrategy bstrategy = GetAccessStrategy(BAS_BULKREAD);
+ BufferAccessStrategy bstrategy = GetAccessStrategy(BAS_BULKREAD);
rel = relation_open(relid, AccessShareLock);
nblocks = RelationGetNumberOfBlocks(rel);
- info = palloc0(offsetof(vbits, bits) + nblocks);
+ info = palloc0(offsetof(vbits, bits) +nblocks);
info->next = 0;
info->count = nblocks;
@@ -320,8 +320,8 @@ collect_visibility_data(Oid relid, bool include_pd)
info->bits[blkno] |= (1 << 1);
/*
- * Page-level data requires reading every block, so only get it if
- * the caller needs it. Use a buffer access strategy, too, to prevent
+ * Page-level data requires reading every block, so only get it if the
+ * caller needs it. Use a buffer access strategy, too, to prevent
* cache-trashing.
*/
if (include_pd)
diff --git a/contrib/pgcrypto/pgp.h b/contrib/pgcrypto/pgp.h
index 88f7f8dc484..804a27018a2 100644
--- a/contrib/pgcrypto/pgp.h
+++ b/contrib/pgcrypto/pgp.h
@@ -124,7 +124,7 @@ struct PGP_S2K
uint8 mode;
uint8 digest_algo;
uint8 salt[8];
- uint8 iter; /* encoded (one-octet) count */
+ uint8 iter; /* encoded (one-octet) count */
/* calculated: */
uint8 key[PGP_MAX_KEY];
uint8 key_len;
diff --git a/contrib/postgres_fdw/connection.c b/contrib/postgres_fdw/connection.c
index 43c7fc9e080..8ca1c1c8986 100644
--- a/contrib/postgres_fdw/connection.c
+++ b/contrib/postgres_fdw/connection.c
@@ -486,11 +486,11 @@ pgfdw_get_result(PGconn *conn, const char *query)
for (;;)
{
- PGresult *res;
+ PGresult *res;
while (PQisBusy(conn))
{
- int wc;
+ int wc;
/* Sleep until there's something to do */
wc = WaitLatchOrSocket(MyLatch,
@@ -675,9 +675,9 @@ pgfdw_xact_callback(XactEvent event, void *arg)
/*
* If a command has been submitted to the remote server by
* using an asynchronous execution function, the command
- * might not have yet completed. Check to see if a command
- * is still being processed by the remote server, and if so,
- * request cancellation of the command.
+ * might not have yet completed. Check to see if a
+ * command is still being processed by the remote server,
+ * and if so, request cancellation of the command.
*/
if (PQtransactionStatus(entry->conn) == PQTRANS_ACTIVE)
{
@@ -689,8 +689,8 @@ pgfdw_xact_callback(XactEvent event, void *arg)
if (!PQcancel(cancel, errbuf, sizeof(errbuf)))
ereport(WARNING,
(errcode(ERRCODE_CONNECTION_FAILURE),
- errmsg("could not send cancel request: %s",
- errbuf)));
+ errmsg("could not send cancel request: %s",
+ errbuf)));
PQfreeCancel(cancel);
}
}
@@ -798,11 +798,11 @@ pgfdw_subxact_callback(SubXactEvent event, SubTransactionId mySubid,
entry->have_error = true;
/*
- * If a command has been submitted to the remote server by using an
- * asynchronous execution function, the command might not have yet
- * completed. Check to see if a command is still being processed by
- * the remote server, and if so, request cancellation of the
- * command.
+ * If a command has been submitted to the remote server by using
+ * an asynchronous execution function, the command might not have
+ * yet completed. Check to see if a command is still being
+ * processed by the remote server, and if so, request cancellation
+ * of the command.
*/
if (PQtransactionStatus(entry->conn) == PQTRANS_ACTIVE)
{
diff --git a/contrib/postgres_fdw/deparse.c b/contrib/postgres_fdw/deparse.c
index 35c27e7fb3c..7d2512cf04d 100644
--- a/contrib/postgres_fdw/deparse.c
+++ b/contrib/postgres_fdw/deparse.c
@@ -1583,10 +1583,10 @@ deparseColumnRef(StringInfo buf, int varno, int varattno, PlannerInfo *root,
/*
* All other system attributes are fetched as 0, except for table OID,
* which is fetched as the local table OID. However, we must be
- * careful; the table could be beneath an outer join, in which case
- * it must go to NULL whenever the rest of the row does.
+ * careful; the table could be beneath an outer join, in which case it
+ * must go to NULL whenever the rest of the row does.
*/
- Oid fetchval = 0;
+ Oid fetchval = 0;
if (varattno == TableOidAttributeNumber)
{
@@ -1633,10 +1633,10 @@ deparseColumnRef(StringInfo buf, int varno, int varattno, PlannerInfo *root,
0 - FirstLowInvalidHeapAttributeNumber);
/*
- * In case the whole-row reference is under an outer join then it has to
- * go NULL whenver the rest of the row goes NULL. Deparsing a join query
- * would always involve multiple relations, thus qualify_col would be
- * true.
+ * In case the whole-row reference is under an outer join then it has
+ * to go NULL whenver the rest of the row goes NULL. Deparsing a join
+ * query would always involve multiple relations, thus qualify_col
+ * would be true.
*/
if (qualify_col)
{
@@ -1652,7 +1652,7 @@ deparseColumnRef(StringInfo buf, int varno, int varattno, PlannerInfo *root,
/* Complete the CASE WHEN statement started above. */
if (qualify_col)
- appendStringInfo(buf," END");
+ appendStringInfo(buf, " END");
heap_close(rel, NoLock);
bms_free(attrs_used);
diff --git a/contrib/postgres_fdw/option.c b/contrib/postgres_fdw/option.c
index f89de2f6947..224aed948eb 100644
--- a/contrib/postgres_fdw/option.c
+++ b/contrib/postgres_fdw/option.c
@@ -133,9 +133,9 @@ postgres_fdw_validator(PG_FUNCTION_ARGS)
}
else if (strcmp(def->defname, "fetch_size") == 0)
{
- int fetch_size;
+ int fetch_size;
- fetch_size = strtol(defGetString(def), NULL,10);
+ fetch_size = strtol(defGetString(def), NULL, 10);
if (fetch_size <= 0)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index 4d172726747..4e31b8e40dd 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -4063,19 +4063,20 @@ foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype,
/*
* Pull the other remote conditions from the joining relations into join
- * clauses or other remote clauses (remote_conds) of this relation wherever
- * possible. This avoids building subqueries at every join step, which is
- * not currently supported by the deparser logic.
+ * clauses or other remote clauses (remote_conds) of this relation
+ * wherever possible. This avoids building subqueries at every join step,
+ * which is not currently supported by the deparser logic.
*
* For an inner join, clauses from both the relations are added to the
- * other remote clauses. For LEFT and RIGHT OUTER join, the clauses from the
- * outer side are added to remote_conds since those can be evaluated after
- * the join is evaluated. The clauses from inner side are added to the
- * joinclauses, since they need to evaluated while constructing the join.
+ * other remote clauses. For LEFT and RIGHT OUTER join, the clauses from
+ * the outer side are added to remote_conds since those can be evaluated
+ * after the join is evaluated. The clauses from inner side are added to
+ * the joinclauses, since they need to evaluated while constructing the
+ * join.
*
- * For a FULL OUTER JOIN, the other clauses from either relation can not be
- * added to the joinclauses or remote_conds, since each relation acts as an
- * outer relation for the other. Consider such full outer join as
+ * For a FULL OUTER JOIN, the other clauses from either relation can not
+ * be added to the joinclauses or remote_conds, since each relation acts
+ * as an outer relation for the other. Consider such full outer join as
* unshippable because of the reasons mentioned above in this comment.
*
* The joining sides can not have local conditions, thus no need to test
diff --git a/contrib/postgres_fdw/postgres_fdw.h b/contrib/postgres_fdw/postgres_fdw.h
index 574b07d16c8..67126bc421f 100644
--- a/contrib/postgres_fdw/postgres_fdw.h
+++ b/contrib/postgres_fdw/postgres_fdw.h
@@ -78,7 +78,7 @@ typedef struct PgFdwRelationInfo
ForeignServer *server;
UserMapping *user; /* only set in use_remote_estimate mode */
- int fetch_size; /* fetch size for this remote table */
+ int fetch_size; /* fetch size for this remote table */
/*
* Name of the relation while EXPLAINing ForeignScan. It is used for join
@@ -133,23 +133,23 @@ extern void deparseUpdateSql(StringInfo buf, PlannerInfo *root,
List *targetAttrs, List *returningList,
List **retrieved_attrs);
extern void deparseDirectUpdateSql(StringInfo buf, PlannerInfo *root,
- Index rtindex, Relation rel,
- List *targetlist,
- List *targetAttrs,
- List *remote_conds,
- List **params_list,
- List *returningList,
- List **retrieved_attrs);
+ Index rtindex, Relation rel,
+ List *targetlist,
+ List *targetAttrs,
+ List *remote_conds,
+ List **params_list,
+ List *returningList,
+ List **retrieved_attrs);
extern void deparseDeleteSql(StringInfo buf, PlannerInfo *root,
Index rtindex, Relation rel,
List *returningList,
List **retrieved_attrs);
extern void deparseDirectDeleteSql(StringInfo buf, PlannerInfo *root,
- Index rtindex, Relation rel,
- List *remote_conds,
- List **params_list,
- List *returningList,
- List **retrieved_attrs);
+ Index rtindex, Relation rel,
+ List *remote_conds,
+ List **params_list,
+ List *returningList,
+ List **retrieved_attrs);
extern void deparseAnalyzeSizeSql(StringInfo buf, Relation rel);
extern void deparseAnalyzeSql(StringInfo buf, Relation rel,
List **retrieved_attrs);
diff --git a/contrib/sslinfo/sslinfo.c b/contrib/sslinfo/sslinfo.c
index 237af6cfd28..82a4c1bd70c 100644
--- a/contrib/sslinfo/sslinfo.c
+++ b/contrib/sslinfo/sslinfo.c
@@ -494,8 +494,8 @@ ssl_extension_info(PG_FUNCTION_ARGS)
if (nid == NID_undef)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("unknown OpenSSL extension in certificate at position %d",
- call_cntr)));
+ errmsg("unknown OpenSSL extension in certificate at position %d",
+ call_cntr)));
values[0] = CStringGetTextDatum(OBJ_nid2sn(nid));
nulls[0] = false;
diff --git a/contrib/test_decoding/test_decoding.c b/contrib/test_decoding/test_decoding.c
index 3336e1e16e7..c3508f0e13d 100644
--- a/contrib/test_decoding/test_decoding.c
+++ b/contrib/test_decoding/test_decoding.c
@@ -65,9 +65,9 @@ static void pg_decode_change(LogicalDecodingContext *ctx,
static bool pg_decode_filter(LogicalDecodingContext *ctx,
RepOriginId origin_id);
static void pg_decode_message(LogicalDecodingContext *ctx,
- ReorderBufferTXN *txn, XLogRecPtr message_lsn,
- bool transactional, const char *prefix,
- Size sz, const char *message);
+ ReorderBufferTXN *txn, XLogRecPtr message_lsn,
+ bool transactional, const char *prefix,
+ Size sz, const char *message);
void
_PG_init(void)