1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-26 23:43:30 +03:00

Update typedefs.list and re-run pgindent

Discussion: http://postgr.es/m/CA+TgmoaA9=1RWKtBWpDaj+sF3Stgc8sHgf5z=KGtbjwPLQVDMA@mail.gmail.com
This commit is contained in:
Robert Haas
2017-11-29 09:24:24 -05:00
parent 801386af62
commit eaedf0df71
52 changed files with 224 additions and 197 deletions

View File

@@ -1314,8 +1314,8 @@ brinsummarize(Relation index, Relation heapRel, BlockNumber pageRange,
/*
* Unless requested to summarize even a partial range, go away now if
* we think the next range is partial. Caller would pass true when
* it is typically run once bulk data loading is done
* we think the next range is partial. Caller would pass true when it
* is typically run once bulk data loading is done
* (brin_summarize_new_values), and false when it is typically the
* result of arbitrarily-scheduled maintenance command (vacuuming).
*/

View File

@@ -41,12 +41,12 @@ printsimple_startup(DestReceiver *self, int operation, TupleDesc tupdesc)
Form_pg_attribute attr = TupleDescAttr(tupdesc, i);
pq_sendstring(&buf, NameStr(attr->attname));
pq_sendint32(&buf, 0); /* table oid */
pq_sendint16(&buf, 0); /* attnum */
pq_sendint32(&buf, 0); /* table oid */
pq_sendint16(&buf, 0); /* attnum */
pq_sendint32(&buf, (int) attr->atttypid);
pq_sendint16(&buf, attr->attlen);
pq_sendint32(&buf, attr->atttypmod);
pq_sendint16(&buf, 0); /* format code */
pq_sendint16(&buf, 0); /* format code */
}
pq_endmessage(&buf);

View File

@@ -6586,10 +6586,10 @@ StartupXLOG(void)
else
{
/*
* We used to attempt to go back to a secondary checkpoint
* record here, but only when not in standby_mode. We now
* just fail if we can't read the last checkpoint because
* this allows us to simplify processing around checkpoints.
* We used to attempt to go back to a secondary checkpoint record
* here, but only when not in standby_mode. We now just fail if we
* can't read the last checkpoint because this allows us to
* simplify processing around checkpoints.
*/
ereport(PANIC,
(errmsg("could not locate a valid checkpoint record")));
@@ -8888,7 +8888,8 @@ CreateCheckPoint(int flags)
(errmsg("concurrent write-ahead log activity while database system is shutting down")));
/*
* Remember the prior checkpoint's redo ptr for UpdateCheckPointDistanceEstimate()
* Remember the prior checkpoint's redo ptr for
* UpdateCheckPointDistanceEstimate()
*/
PriorRedoPtr = ControlFile->checkPointCopy.redo;
@@ -9211,7 +9212,8 @@ CreateRestartPoint(int flags)
CheckPointGuts(lastCheckPoint.redo, flags);
/*
* Remember the prior checkpoint's redo ptr for UpdateCheckPointDistanceEstimate()
* Remember the prior checkpoint's redo ptr for
* UpdateCheckPointDistanceEstimate()
*/
PriorRedoPtr = ControlFile->checkPointCopy.redo;

View File

@@ -802,7 +802,7 @@ void
XLogReadDetermineTimeline(XLogReaderState *state, XLogRecPtr wantPage, uint32 wantLength)
{
const XLogRecPtr lastReadPage = state->readSegNo *
state->wal_segment_size + state->readOff;
state->wal_segment_size + state->readOff;
Assert(wantPage != InvalidXLogRecPtr && wantPage % XLOG_BLCKSZ == 0);
Assert(wantLength <= XLOG_BLCKSZ);

View File

@@ -2134,7 +2134,7 @@ get_qual_for_range(Relation parent, PartitionBoundSpec *spec,
if (or_expr_args != NIL)
{
Expr *other_parts_constr;
Expr *other_parts_constr;
/*
* Combine the constraints obtained for non-default partitions
@@ -2143,20 +2143,20 @@ get_qual_for_range(Relation parent, PartitionBoundSpec *spec,
* useless repetition). Add the same now.
*/
other_parts_constr =
makeBoolExpr(AND_EXPR,
lappend(get_range_nulltest(key),
list_length(or_expr_args) > 1
? makeBoolExpr(OR_EXPR, or_expr_args,
-1)
: linitial(or_expr_args)),
-1);
makeBoolExpr(AND_EXPR,
lappend(get_range_nulltest(key),
list_length(or_expr_args) > 1
? makeBoolExpr(OR_EXPR, or_expr_args,
-1)
: linitial(or_expr_args)),
-1);
/*
* Finally, the default partition contains everything *NOT*
* contained in the non-default partitions.
*/
result = list_make1(makeBoolExpr(NOT_EXPR,
list_make1(other_parts_constr), -1));
list_make1(other_parts_constr), -1));
}
return result;
@@ -2502,9 +2502,9 @@ generate_partition_qual(Relation rel)
int
get_partition_for_tuple(Relation relation, Datum *values, bool *isnull)
{
int bound_offset;
int part_index = -1;
PartitionKey key = RelationGetPartitionKey(relation);
int bound_offset;
int part_index = -1;
PartitionKey key = RelationGetPartitionKey(relation);
PartitionDesc partdesc = RelationGetPartitionDesc(relation);
/* Route as appropriate based on partitioning strategy. */
@@ -2513,8 +2513,8 @@ get_partition_for_tuple(Relation relation, Datum *values, bool *isnull)
case PARTITION_STRATEGY_HASH:
{
PartitionBoundInfo boundinfo = partdesc->boundinfo;
int greatest_modulus = get_greatest_modulus(boundinfo);
uint64 rowHash = compute_hash_value(key, values, isnull);
int greatest_modulus = get_greatest_modulus(boundinfo);
uint64 rowHash = compute_hash_value(key, values, isnull);
part_index = boundinfo->indexes[rowHash % greatest_modulus];
}
@@ -2548,8 +2548,7 @@ get_partition_for_tuple(Relation relation, Datum *values, bool *isnull)
/*
* No range includes NULL, so this will be accepted by the
* default partition if there is one, and otherwise
* rejected.
* default partition if there is one, and otherwise rejected.
*/
for (i = 0; i < key->partnatts; i++)
{
@@ -2563,7 +2562,7 @@ get_partition_for_tuple(Relation relation, Datum *values, bool *isnull)
if (!range_partkey_has_null)
{
bound_offset = partition_bound_bsearch(key,
partdesc->boundinfo,
partdesc->boundinfo,
values,
false,
&equal);
@@ -2585,8 +2584,8 @@ get_partition_for_tuple(Relation relation, Datum *values, bool *isnull)
}
/*
* part_index < 0 means we failed to find a partition of this parent.
* Use the default partition, if there is one.
* part_index < 0 means we failed to find a partition of this parent. Use
* the default partition, if there is one.
*/
if (part_index < 0)
part_index = partdesc->boundinfo->default_index;
@@ -3125,7 +3124,7 @@ satisfies_hash_partition(PG_FUNCTION_ARGS)
bool variadic_typbyval;
char variadic_typalign;
FmgrInfo partsupfunc[PARTITION_MAX_KEYS];
} ColumnsHashData;
} ColumnsHashData;
Oid parentId;
int modulus;
int remainder;

View File

@@ -168,7 +168,7 @@ typedef struct CopyStateData
PartitionDispatch *partition_dispatch_info;
int num_dispatch; /* Number of entries in the above array */
int num_partitions; /* Number of members in the following arrays */
ResultRelInfo **partitions; /* Per partition result relation pointers */
ResultRelInfo **partitions; /* Per partition result relation pointers */
TupleConversionMap **partition_tupconv_maps;
TupleTableSlot *partition_tuple_slot;
TransitionCaptureState *transition_capture;
@@ -360,7 +360,7 @@ SendCopyBegin(CopyState cstate)
pq_sendbyte(&buf, format); /* overall format */
pq_sendint16(&buf, natts);
for (i = 0; i < natts; i++)
pq_sendint16(&buf, format); /* per-column formats */
pq_sendint16(&buf, format); /* per-column formats */
pq_endmessage(&buf);
cstate->copy_dest = COPY_NEW_FE;
}
@@ -393,7 +393,7 @@ ReceiveCopyBegin(CopyState cstate)
pq_sendbyte(&buf, format); /* overall format */
pq_sendint16(&buf, natts);
for (i = 0; i < natts; i++)
pq_sendint16(&buf, format); /* per-column formats */
pq_sendint16(&buf, format); /* per-column formats */
pq_endmessage(&buf);
cstate->copy_dest = COPY_NEW_FE;
cstate->fe_msgbuf = makeStringInfo();

View File

@@ -355,7 +355,7 @@ lazy_vacuum_rel(Relation onerel, int options, VacuumParams *params,
params->log_min_duration))
{
StringInfoData buf;
char *msgfmt;
char *msgfmt;
TimestampDifference(starttime, endtime, &secs, &usecs);

View File

@@ -184,10 +184,10 @@ ExecFindPartition(ResultRelInfo *resultRelInfo, PartitionDispatch *pd,
parent = pd[0];
while (true)
{
PartitionDesc partdesc;
PartitionDesc partdesc;
TupleTableSlot *myslot = parent->tupslot;
TupleConversionMap *map = parent->tupmap;
int cur_index = -1;
int cur_index = -1;
rel = parent->reldesc;
partdesc = RelationGetPartitionDesc(rel);

View File

@@ -1518,8 +1518,8 @@ ExecSetupTransitionCaptureState(ModifyTableState *mtstate, EState *estate)
if (mtstate->mt_partition_dispatch_info != NULL)
{
/*
* For tuple routing among partitions, we need TupleDescs based
* on the partition routing table.
* For tuple routing among partitions, we need TupleDescs based on
* the partition routing table.
*/
ResultRelInfo **resultRelInfos = mtstate->mt_partitions;

View File

@@ -791,6 +791,7 @@ read_client_first_message(scram_state *state, char *input)
switch (*input)
{
case 'n':
/*
* The client does not support channel binding or has simply
* decided to not use it. In that case just let it go.
@@ -805,6 +806,7 @@ read_client_first_message(scram_state *state, char *input)
input++;
break;
case 'y':
/*
* The client supports channel binding and thinks that the server
* does not. In this case, the server must fail authentication if
@@ -827,12 +829,13 @@ read_client_first_message(scram_state *state, char *input)
input++;
break;
case 'p':
/*
* The client requires channel binding. Channel binding type
* follows, e.g., "p=tls-unique".
*/
{
char *channel_binding_type;
char *channel_binding_type;
if (!state->ssl_in_use)
{
@@ -1139,8 +1142,8 @@ read_client_final_message(scram_state *state, char *input)
b64_message[b64_message_len] = '\0';
/*
* Compare the value sent by the client with the value expected by
* the server.
* Compare the value sent by the client with the value expected by the
* server.
*/
if (strcmp(channel_binding, b64_message) != 0)
ereport(ERROR,

View File

@@ -100,7 +100,8 @@ static struct pam_conv pam_passw_conv = {
NULL
};
static const char *pam_passwd = NULL; /* Workaround for Solaris 2.6 brokenness */
static const char *pam_passwd = NULL; /* Workaround for Solaris 2.6
* brokenness */
static Port *pam_port_cludge; /* Workaround for passing "Port *port" into
* pam_passwd_conv_proc */
#endif /* USE_PAM */
@@ -914,6 +915,7 @@ CheckSCRAMAuth(Port *port, char *shadow_pass, char **logdetail)
pfree(sasl_mechs);
#ifdef USE_SSL
/*
* Get data for channel binding.
*/
@@ -2343,7 +2345,7 @@ CheckBSDAuth(Port *port, char *user)
*/
#ifdef USE_LDAP
static int errdetail_for_ldap(LDAP *ldap);
static int errdetail_for_ldap(LDAP *ldap);
/*
* Initialize a connection to the LDAP server, including setting up
@@ -2514,7 +2516,7 @@ CheckLDAPAuth(Port *port)
char *filter;
LDAPMessage *search_message;
LDAPMessage *entry;
char *attributes[] = { LDAP_NO_ATTRS, NULL };
char *attributes[] = {LDAP_NO_ATTRS, NULL};
char *dn;
char *c;
int count;

View File

@@ -1795,7 +1795,7 @@ set_upper_references(PlannerInfo *root, Plan *plan, int rtoffset)
static void
set_param_references(PlannerInfo *root, Plan *plan)
{
Assert(IsA(plan, Gather) || IsA(plan, GatherMerge));
Assert(IsA(plan, Gather) ||IsA(plan, GatherMerge));
if (plan->lefttree->extParam)
{

View File

@@ -1118,7 +1118,7 @@ is_parallel_safe(PlannerInfo *root, Node *node)
foreach(l2, initsubplan->setParam)
context.safe_param_ids = lcons_int(lfirst_int(l2),
context.safe_param_ids);
context.safe_param_ids);
}
}

View File

@@ -2412,7 +2412,7 @@ apply_projection_to_path(PlannerInfo *root,
* workers can help project. But if there is something that is not
* parallel-safe in the target expressions, then we can't.
*/
if ((IsA(path, GatherPath) || IsA(path, GatherMergePath)) &&
if ((IsA(path, GatherPath) ||IsA(path, GatherMergePath)) &&
is_parallel_safe(root, (Node *) target->exprs))
{
/*
@@ -2421,9 +2421,9 @@ apply_projection_to_path(PlannerInfo *root,
* It seems unlikely at present that there could be any other
* references to the subpath, but better safe than sorry.
*
* Note that we don't change the parallel path's cost estimates; it might
* be appropriate to do so, to reflect the fact that the bulk of the
* target evaluation will happen in workers.
* Note that we don't change the parallel path's cost estimates; it
* might be appropriate to do so, to reflect the fact that the bulk of
* the target evaluation will happen in workers.
*/
if (IsA(path, GatherPath))
{

View File

@@ -1825,7 +1825,7 @@ set_relation_partition_info(PlannerInfo *root, RelOptInfo *rel,
Relation relation)
{
PartitionDesc partdesc;
PartitionKey partkey;
PartitionKey partkey;
Assert(relation->rd_rel->relkind == RELKIND_PARTITIONED_TABLE);
@@ -1890,8 +1890,8 @@ find_partition_scheme(PlannerInfo *root, Relation relation)
/*
* Did not find matching partition scheme. Create one copying relevant
* information from the relcache. We need to copy the contents of the array
* since the relcache entry may not survive after we have closed the
* information from the relcache. We need to copy the contents of the
* array since the relcache entry may not survive after we have closed the
* relation.
*/
part_scheme = (PartitionScheme) palloc0(sizeof(PartitionSchemeData));

View File

@@ -873,11 +873,11 @@ build_joinrel_tlist(PlannerInfo *root, RelOptInfo *joinrel,
continue;
/*
* Otherwise, anything in a baserel or joinrel targetlist ought to be a
* Var. Children of a partitioned table may have ConvertRowtypeExpr
* translating whole-row Var of a child to that of the parent. Children
* of an inherited table or subquery child rels can not directly
* participate in a join, so other kinds of nodes here.
* Otherwise, anything in a baserel or joinrel targetlist ought to be
* a Var. Children of a partitioned table may have ConvertRowtypeExpr
* translating whole-row Var of a child to that of the parent.
* Children of an inherited table or subquery child rels can not
* directly participate in a join, so other kinds of nodes here.
*/
if (IsA(var, Var))
{
@@ -901,7 +901,7 @@ build_joinrel_tlist(PlannerInfo *root, RelOptInfo *joinrel,
child_expr = (ConvertRowtypeExpr *) childvar;
childvar = (Var *) child_expr->arg;
}
Assert(IsA(childvar, Var) && childvar->varattno == 0);
Assert(IsA(childvar, Var) &&childvar->varattno == 0);
baserel = find_base_rel(root, childvar->varno);
ndx = 0 - baserel->min_attr;
@@ -1666,18 +1666,19 @@ build_joinrel_partition_info(RelOptInfo *joinrel, RelOptInfo *outer_rel,
partnatts = joinrel->part_scheme->partnatts;
joinrel->partexprs = (List **) palloc0(sizeof(List *) * partnatts);
joinrel->nullable_partexprs =
(List **) palloc0(sizeof(List *) *partnatts);
(List **) palloc0(sizeof(List *) * partnatts);
/*
* Construct partition keys for the join.
*
* An INNER join between two partitioned relations can be regarded as
* partitioned by either key expression. For example, A INNER JOIN B ON A.a =
* B.b can be regarded as partitioned on A.a or on B.b; they are equivalent.
* partitioned by either key expression. For example, A INNER JOIN B ON
* A.a = B.b can be regarded as partitioned on A.a or on B.b; they are
* equivalent.
*
* For a SEMI or ANTI join, the result can only be regarded as being
* partitioned in the same manner as the outer side, since the inner columns
* are not retained.
* partitioned in the same manner as the outer side, since the inner
* columns are not retained.
*
* An OUTER join like (A LEFT JOIN B ON A.a = B.b) may produce rows with
* B.b NULL. These rows may not fit the partitioning conditions imposed on
@@ -1686,11 +1687,12 @@ build_joinrel_partition_info(RelOptInfo *joinrel, RelOptInfo *outer_rel,
* expressions from the OUTER side only. However, because all
* commonly-used comparison operators are strict, the presence of nulls on
* the outer side doesn't cause any problem; they can't match anything at
* future join levels anyway. Therefore, we track two sets of expressions:
* those that authentically partition the relation (partexprs) and those
* that partition the relation with the exception that extra nulls may be
* present (nullable_partexprs). When the comparison operator is strict,
* the latter is just as good as the former.
* future join levels anyway. Therefore, we track two sets of
* expressions: those that authentically partition the relation
* (partexprs) and those that partition the relation with the exception
* that extra nulls may be present (nullable_partexprs). When the
* comparison operator is strict, the latter is just as good as the
* former.
*/
for (cnt = 0; cnt < partnatts; cnt++)
{

View File

@@ -1253,7 +1253,7 @@ GetBackgroundWorkerTypeByPid(pid_t pid)
{
int slotno;
bool found = false;
static char result[BGW_MAXLEN];
static char result[BGW_MAXLEN];
LWLockAcquire(BackgroundWorkerLock, LW_SHARED);

View File

@@ -2161,8 +2161,8 @@ retry1:
/*
* If the client requested a newer protocol version or if the client
* requested any protocol options we didn't recognize, let them know
* the newest minor protocol version we do support and the names of any
* unrecognized options.
* the newest minor protocol version we do support and the names of
* any unrecognized options.
*/
if (PG_PROTOCOL_MINOR(proto) > PG_PROTOCOL_MINOR(PG_PROTOCOL_LATEST) ||
unrecognized_protocol_options != NIL)
@@ -4316,8 +4316,8 @@ BackendInitialize(Port *port)
*
* postgres: walsender <user> <host> <activity>
*
* To achieve that, we pass "walsender" as username and username
* as dbname to init_ps_display(). XXX: should add a new variant of
* To achieve that, we pass "walsender" as username and username as dbname
* to init_ps_display(). XXX: should add a new variant of
* init_ps_display() to avoid abusing the parameters like this.
*/
if (am_walsender)

View File

@@ -278,7 +278,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
/* Send CopyOutResponse message */
pq_beginmessage(&buf, 'H');
pq_sendbyte(&buf, 0); /* overall format */
pq_sendint16(&buf, 0); /* natts */
pq_sendint16(&buf, 0); /* natts */
pq_endmessage(&buf);
if (ti->path == NULL)
@@ -744,7 +744,7 @@ SendBackupHeader(List *tablespaces)
pq_sendstring(&buf, "spcoid");
pq_sendint32(&buf, 0); /* table oid */
pq_sendint16(&buf, 0); /* attnum */
pq_sendint32(&buf, OIDOID); /* type oid */
pq_sendint32(&buf, OIDOID); /* type oid */
pq_sendint16(&buf, 4); /* typlen */
pq_sendint32(&buf, 0); /* typmod */
pq_sendint16(&buf, 0); /* format code */
@@ -774,10 +774,10 @@ SendBackupHeader(List *tablespaces)
/* Send one datarow message */
pq_beginmessage(&buf, 'D');
pq_sendint16(&buf, 3); /* number of columns */
pq_sendint16(&buf, 3); /* number of columns */
if (ti->path == NULL)
{
pq_sendint32(&buf, -1); /* Length = -1 ==> NULL */
pq_sendint32(&buf, -1); /* Length = -1 ==> NULL */
pq_sendint32(&buf, -1);
}
else
@@ -795,7 +795,7 @@ SendBackupHeader(List *tablespaces)
if (ti->size >= 0)
send_int8_string(&buf, ti->size / 1024);
else
pq_sendint32(&buf, -1); /* NULL */
pq_sendint32(&buf, -1); /* NULL */
pq_endmessage(&buf);
}

View File

@@ -246,8 +246,8 @@ ReorderBufferAllocate(void)
sizeof(ReorderBufferTXN));
buffer->tup_context = GenerationContextCreate(new_ctx,
"Tuples",
SLAB_LARGE_BLOCK_SIZE);
"Tuples",
SLAB_LARGE_BLOCK_SIZE);
hash_ctl.keysize = sizeof(TransactionId);
hash_ctl.entrysize = sizeof(ReorderBufferTXNByIdEnt);

View File

@@ -601,7 +601,7 @@ smgrextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
char *buffer, bool skipFsync)
{
smgrsw[reln->smgr_which].smgr_extend(reln, forknum, blocknum,
buffer, skipFsync);
buffer, skipFsync);
}
/*
@@ -648,7 +648,7 @@ smgrwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
char *buffer, bool skipFsync)
{
smgrsw[reln->smgr_which].smgr_write(reln, forknum, blocknum,
buffer, skipFsync);
buffer, skipFsync);
}
@@ -661,7 +661,7 @@ smgrwriteback(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
BlockNumber nblocks)
{
smgrsw[reln->smgr_which].smgr_writeback(reln, forknum, blocknum,
nblocks);
nblocks);
}
/*

View File

@@ -2374,8 +2374,8 @@ exec_describe_statement_message(const char *stmt_name)
/*
* First describe the parameters...
*/
pq_beginmessage_reuse(&row_description_buf, 't'); /* parameter description
* message type */
pq_beginmessage_reuse(&row_description_buf, 't'); /* parameter description
* message type */
pq_sendint16(&row_description_buf, psrc->num_params);
for (i = 0; i < psrc->num_params; i++)
@@ -2952,14 +2952,14 @@ ProcessInterrupts(void)
/*
* Don't allow query cancel interrupts while reading input from the
* client, because we might lose sync in the FE/BE protocol. (Die
* interrupts are OK, because we won't read any further messages from
* the client in that case.)
* interrupts are OK, because we won't read any further messages from the
* client in that case.)
*/
if (QueryCancelPending && QueryCancelHoldoffCount != 0)
{
/*
* Re-arm InterruptPending so that we process the cancel request
* as soon as we're done reading the message.
* Re-arm InterruptPending so that we process the cancel request as
* soon as we're done reading the message.
*/
InterruptPending = true;
}
@@ -4494,10 +4494,10 @@ ShowUsage(const char *title)
appendStringInfo(&str,
"!\t%ld kB max resident size\n",
#if defined(__darwin__)
/* in bytes on macOS */
r.ru_maxrss/1024
/* in bytes on macOS */
r.ru_maxrss / 1024
#else
/* in kilobytes on most other platforms */
/* in kilobytes on most other platforms */
r.ru_maxrss
#endif
);

View File

@@ -202,7 +202,7 @@ static int
cmpspellaffix(const void *s1, const void *s2)
{
return strcmp((*(SPELL *const *) s1)->p.flag,
(*(SPELL *const *) s2)->p.flag);
(*(SPELL *const *) s2)->p.flag);
}
static int

View File

@@ -2231,7 +2231,7 @@ timetz_hash_extended(PG_FUNCTION_ARGS)
Int64GetDatumFast(key->time),
seed));
thash ^= DatumGetUInt64(hash_uint32_extended(key->zone,
DatumGetInt64(seed)));
DatumGetInt64(seed)));
PG_RETURN_UINT64(thash);
}

View File

@@ -921,8 +921,8 @@ pg_stat_get_backend_activity(PG_FUNCTION_ARGS)
int32 beid = PG_GETARG_INT32(0);
PgBackendStatus *beentry;
const char *activity;
char *clipped_activity;
text *ret;
char *clipped_activity;
text *ret;
if ((beentry = pgstat_fetch_stat_beentry(beid)) == NULL)
activity = "<backend information not available>";

View File

@@ -46,7 +46,7 @@
#define Generation_BLOCKHDRSZ MAXALIGN(sizeof(GenerationBlock))
#define Generation_CHUNKHDRSZ sizeof(GenerationChunk)
typedef struct GenerationBlock GenerationBlock; /* forward reference */
typedef struct GenerationBlock GenerationBlock; /* forward reference */
typedef struct GenerationChunk GenerationChunk;
typedef void *GenerationPointer;
@@ -62,9 +62,9 @@ typedef struct GenerationContext
/* Generational context parameters */
Size blockSize; /* standard block size */
GenerationBlock *block; /* current (most recently allocated) block */
GenerationBlock *block; /* current (most recently allocated) block */
dlist_head blocks; /* list of blocks */
} GenerationContext;
} GenerationContext;
/*
* GenerationBlock
@@ -155,7 +155,7 @@ static void GenerationDelete(MemoryContext context);
static Size GenerationGetChunkSpace(MemoryContext context, void *pointer);
static bool GenerationIsEmpty(MemoryContext context);
static void GenerationStats(MemoryContext context, int level, bool print,
MemoryContextCounters *totals);
MemoryContextCounters *totals);
#ifdef MEMORY_CONTEXT_CHECKING
static void GenerationCheck(MemoryContext context);
@@ -207,10 +207,10 @@ static MemoryContextMethods GenerationMethods = {
*/
MemoryContext
GenerationContextCreate(MemoryContext parent,
const char *name,
Size blockSize)
const char *name,
Size blockSize)
{
GenerationContext *set;
GenerationContext *set;
/* Assert we padded GenerationChunk properly */
StaticAssertStmt(Generation_CHUNKHDRSZ == MAXALIGN(Generation_CHUNKHDRSZ),
@@ -233,10 +233,10 @@ GenerationContextCreate(MemoryContext parent,
/* Do the type-independent part of context creation */
set = (GenerationContext *) MemoryContextCreate(T_GenerationContext,
sizeof(GenerationContext),
&GenerationMethods,
parent,
name);
sizeof(GenerationContext),
&GenerationMethods,
parent,
name);
set->blockSize = blockSize;
@@ -250,7 +250,7 @@ GenerationContextCreate(MemoryContext parent,
static void
GenerationInit(MemoryContext context)
{
GenerationContext *set = (GenerationContext *) context;
GenerationContext *set = (GenerationContext *) context;
set->block = NULL;
dlist_init(&set->blocks);
@@ -266,7 +266,7 @@ GenerationInit(MemoryContext context)
static void
GenerationReset(MemoryContext context)
{
GenerationContext *set = (GenerationContext *) context;
GenerationContext *set = (GenerationContext *) context;
dlist_mutable_iter miter;
AssertArg(GenerationIsValid(set));
@@ -324,9 +324,9 @@ GenerationDelete(MemoryContext context)
static void *
GenerationAlloc(MemoryContext context, Size size)
{
GenerationContext *set = (GenerationContext *) context;
GenerationBlock *block;
GenerationChunk *chunk;
GenerationContext *set = (GenerationContext *) context;
GenerationBlock *block;
GenerationChunk *chunk;
Size chunk_size = MAXALIGN(size);
/* is it an over-sized chunk? if yes, allocate special block */
@@ -460,9 +460,9 @@ GenerationAlloc(MemoryContext context, Size size)
static void
GenerationFree(MemoryContext context, void *pointer)
{
GenerationContext *set = (GenerationContext *) context;
GenerationChunk *chunk = GenerationPointerGetChunk(pointer);
GenerationBlock *block;
GenerationContext *set = (GenerationContext *) context;
GenerationChunk *chunk = GenerationPointerGetChunk(pointer);
GenerationBlock *block;
/* Allow access to private part of chunk header. */
VALGRIND_MAKE_MEM_DEFINED(chunk, GENERATIONCHUNK_PRIVATE_LEN);
@@ -474,7 +474,7 @@ GenerationFree(MemoryContext context, void *pointer)
if (chunk->requested_size < chunk->size)
if (!sentinel_ok(pointer, chunk->requested_size))
elog(WARNING, "detected write past chunk end in %s %p",
((MemoryContext)set)->name, chunk);
((MemoryContext) set)->name, chunk);
#endif
#ifdef CLOBBER_FREED_MEMORY
@@ -520,9 +520,9 @@ GenerationFree(MemoryContext context, void *pointer)
static void *
GenerationRealloc(MemoryContext context, void *pointer, Size size)
{
GenerationContext *set = (GenerationContext *) context;
GenerationChunk *chunk = GenerationPointerGetChunk(pointer);
GenerationPointer newPointer;
GenerationContext *set = (GenerationContext *) context;
GenerationChunk *chunk = GenerationPointerGetChunk(pointer);
GenerationPointer newPointer;
Size oldsize;
/* Allow access to private part of chunk header. */
@@ -535,7 +535,7 @@ GenerationRealloc(MemoryContext context, void *pointer, Size size)
if (chunk->requested_size < oldsize)
if (!sentinel_ok(pointer, chunk->requested_size))
elog(WARNING, "detected write past chunk end in %s %p",
((MemoryContext)set)->name, chunk);
((MemoryContext) set)->name, chunk);
#endif
/*
@@ -652,7 +652,7 @@ GenerationGetChunkSpace(MemoryContext context, void *pointer)
static bool
GenerationIsEmpty(MemoryContext context)
{
GenerationContext *set = (GenerationContext *) context;
GenerationContext *set = (GenerationContext *) context;
return dlist_is_empty(&set->blocks);
}
@@ -670,9 +670,9 @@ GenerationIsEmpty(MemoryContext context)
*/
static void
GenerationStats(MemoryContext context, int level, bool print,
MemoryContextCounters *totals)
MemoryContextCounters *totals)
{
GenerationContext *set = (GenerationContext *) context;
GenerationContext *set = (GenerationContext *) context;
Size nblocks = 0;
Size nchunks = 0;
Size nfreechunks = 0;
@@ -698,8 +698,8 @@ GenerationStats(MemoryContext context, int level, bool print,
for (i = 0; i < level; i++)
fprintf(stderr, " ");
fprintf(stderr,
"Generation: %s: %zu total in %zd blocks (%zd chunks); %zu free (%zd chunks); %zu used\n",
((MemoryContext)set)->name, totalspace, nblocks, nchunks, freespace,
"Generation: %s: %zu total in %zd blocks (%zd chunks); %zu free (%zd chunks); %zu used\n",
((MemoryContext) set)->name, totalspace, nblocks, nchunks, freespace,
nfreechunks, totalspace - freespace);
}
@@ -726,7 +726,7 @@ GenerationStats(MemoryContext context, int level, bool print,
static void
GenerationCheck(MemoryContext context)
{
GenerationContext *gen = (GenerationContext *) context;
GenerationContext *gen = (GenerationContext *) context;
char *name = context->name;
dlist_iter iter;
@@ -818,4 +818,4 @@ GenerationCheck(MemoryContext context)
}
}
#endif /* MEMORY_CONTEXT_CHECKING */
#endif /* MEMORY_CONTEXT_CHECKING */

View File

@@ -1591,8 +1591,7 @@ puttuple_common(Tuplesortstate *state, SortTuple *tuple)
case TSS_BUILDRUNS:
/*
* Save the tuple into the unsorted array (there must be
* space)
* Save the tuple into the unsorted array (there must be space)
*/
state->memtuples[state->memtupcount++] = *tuple;
@@ -2742,8 +2741,8 @@ dumptuples(Tuplesortstate *state, bool alltuples)
int i;
/*
* Nothing to do if we still fit in available memory and have array
* slots, unless this is the final call during initial run generation.
* Nothing to do if we still fit in available memory and have array slots,
* unless this is the final call during initial run generation.
*/
if (state->memtupcount < state->memtupsize && !LACKMEM(state) &&
!alltuples)