Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8548ddc

Browse files
committed
Fix inconsistencies and typos in the tree, take 9
This addresses more issues with code comments, variable names and unreferenced variables. Author: Alexander Lakhin Discussion: https://postgr.es/m/7ab243e0-116d-3e44-d120-76b3df7abefd@gmail.com
1 parent 7550619 commit 8548ddc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+94
-121
lines changed

contrib/pg_standby/pg_standby.c

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ char *triggerPath; /* where to find the trigger file? */
5858
char *xlogFilePath; /* where we are going to restore to */
5959
char *nextWALFileName; /* the file we need to get from archive */
6060
char *restartWALFileName; /* the file from which we can restart restore */
61-
char *priorWALFileName; /* the file we need to get from archive */
6261
char WALFilePath[MAXPGPATH * 2]; /* the file path including archive */
6362
char restoreCommand[MAXPGPATH]; /* run this to restore */
6463
char exclusiveCleanupFileName[MAXFNAMELEN]; /* the file we need to get

contrib/pgcrypto/pgp-pgsql.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ pgp_pub_decrypt_text(PG_FUNCTION_ARGS)
761761
*/
762762

763763
/*
764-
* Helper function for pgp_armor. Converts arrays of keys and values into
764+
* Helper function for pg_armor. Converts arrays of keys and values into
765765
* plain C arrays, and checks that they don't contain invalid characters.
766766
*/
767767
static int

contrib/pgcrypto/px.h

-3
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ void *px_realloc(void *p, size_t s);
5050
void px_free(void *p);
5151
#endif
5252

53-
/* max len of 'type' parms */
54-
#define PX_MAX_NAMELEN 128
55-
5653
/* max salt returned */
5754
#define PX_MAX_SALT_LEN 128
5855

contrib/pgcrypto/sha1.c

-10
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,6 @@ static uint32 _K[] = {0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6};
5959
#define BCOUNT (ctxt->c.b64[0] / 8)
6060
#define W(n) (ctxt->m.b32[(n)])
6161

62-
#define PUTBYTE(x) \
63-
do { \
64-
ctxt->m.b8[(COUNT % 64)] = (x); \
65-
COUNT++; \
66-
COUNT %= 64; \
67-
ctxt->c.b64[0] += 8; \
68-
if (COUNT % 64 == 0) \
69-
sha1_step(ctxt); \
70-
} while (0)
71-
7262
#define PUTPAD(x) \
7363
do { \
7464
ctxt->m.b8[(COUNT % 64)] = (x); \

contrib/postgres_fdw/postgres_fdw.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2794,7 +2794,7 @@ estimate_path_cost_size(PlannerInfo *root,
27942794

27952795
/*
27962796
* Back into an estimate of the number of retrieved rows. Just in
2797-
* case this is nuts, clamp to at most nrow.
2797+
* case this is nuts, clamp to at most nrows.
27982798
*/
27992799
retrieved_rows = clamp_row_est(rows / fpinfo->local_conds_sel);
28002800
retrieved_rows = Min(retrieved_rows, nrows);

contrib/sepgsql/sepgsql.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ extern void sepgsql_avc_init(void);
271271
*/
272272
extern char *sepgsql_get_client_label(void);
273273
extern void sepgsql_init_client_label(void);
274-
extern char *sepgsql_get_label(Oid relOid, Oid objOid, int32 subId);
274+
extern char *sepgsql_get_label(Oid classId, Oid objectId, int32 subId);
275275

276276
extern void sepgsql_object_relabel(const ObjectAddress *object,
277277
const char *seclabel);

contrib/test_decoding/test_decoding.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
PG_MODULE_MAGIC;
2626

27-
/* These must be available to pg_dlsym() */
27+
/* These must be available to dlsym() */
2828
extern void _PG_init(void);
2929
extern void _PG_output_plugin_init(OutputPluginCallbacks *cb);
3030

doc/src/sgml/libpq.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5509,7 +5509,7 @@ int PQendcopy(PGconn *conn);
55095509
It should either be issued when the last string has been sent
55105510
to the server using <xref linkend="libpq-PQputline"/> or when the
55115511
last string has been received from the server using
5512-
<function>PGgetline</function>. It must be issued or the server
5512+
<function>PQgetline</function>. It must be issued or the server
55135513
will get <quote>out of sync</quote> with the client. Upon return
55145514
from this function, the server is ready to receive the next SQL
55155515
command. The return value is 0 on successful completion,

doc/src/sgml/ref/set_role.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ RESET ROLE
7070
effectively drops all the privileges assigned directly to the session user
7171
and to the other roles it is a member of, leaving only the privileges
7272
available to the named role. On the other hand, if the session user role
73-
has the <literal>NOINHERITS</literal> attribute, <command>SET ROLE</command> drops the
73+
has the <literal>NOINHERIT</literal> attribute, <command>SET ROLE</command> drops the
7474
privileges assigned directly to the session user and instead acquires the
7575
privileges available to the named role.
7676
</para>

doc/src/sgml/sslinfo.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ countryName (alias C)
185185
localityName (alias L)
186186
stateOrProvinceName (alias ST)
187187
organizationName (alias O)
188-
organizationUnitName (alias OU)
188+
organizationalUnitName (alias OU)
189189
title
190190
description
191191
initials

src/backend/access/gin/README

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ is stored in the higher bits. That requires 43 bits in total, which
270270
conveniently fits in at most 6 bytes.
271271

272272
A compressed posting list is passed around and stored on disk in a
273-
PackedPostingList struct. The first item in the list is stored uncompressed
273+
GinPostingList struct. The first item in the list is stored uncompressed
274274
as a regular ItemPointerData, followed by the length of the list in bytes,
275275
followed by the packed items.
276276

src/backend/access/gin/ginbtree.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ ginPlaceToPage(GinBtree btree, GinBtreeStack *stack,
650650
}
651651
else
652652
{
653-
elog(ERROR, "invalid return code from GIN placeToPage method: %d", rc);
653+
elog(ERROR, "invalid return code from GIN beginPlaceToPage method: %d", rc);
654654
result = false; /* keep compiler quiet */
655655
}
656656

src/backend/access/gist/gistget.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ gistkillitems(IndexScanDesc scan)
7474

7575
/*
7676
* Mark all killedItems as dead. We need no additional recheck, because,
77-
* if page was modified, pageLSN must have changed.
77+
* if page was modified, curPageLSN must have changed.
7878
*/
7979
for (i = 0; i < so->numKilled; i++)
8080
{
@@ -379,11 +379,11 @@ gistScanPage(IndexScanDesc scan, GISTSearchItem *pageItem, double *myDistances,
379379

380380
/*
381381
* Check if the page was deleted after we saw the downlink. There's
382-
* nothing of interest on a deleted page. Note that we must do this
383-
* after checking the NSN for concurrent splits! It's possible that
384-
* the page originally contained some tuples that are visible to us,
385-
* but was split so that all the visible tuples were moved to another
386-
* page, and then this page was deleted.
382+
* nothing of interest on a deleted page. Note that we must do this after
383+
* checking the NSN for concurrent splits! It's possible that the page
384+
* originally contained some tuples that are visible to us, but was split
385+
* so that all the visible tuples were moved to another page, and then
386+
* this page was deleted.
387387
*/
388388
if (GistPageIsDeleted(page))
389389
{

src/backend/access/hash/hash_xlog.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ hash_xlog_squeeze_page(XLogReaderState *record)
706706

707707
/*
708708
* if the page on which are adding tuples is a page previous to freed
709-
* overflow page, then update its nextblno.
709+
* overflow page, then update its nextblkno.
710710
*/
711711
if (xldata->is_prev_bucket_same_wrt)
712712
{

src/backend/access/hash/hashinsert.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ _hash_doinsert(Relation rel, IndexTuple itup, Relation heapRel)
257257
* _hash_pgaddtup() -- add a tuple to a particular page in the index.
258258
*
259259
* This routine adds the tuple to the page as requested; it does not write out
260-
* the page. It is an error to call pgaddtup() without pin and write lock on
261-
* the target buffer.
260+
* the page. It is an error to call this function without pin and write lock
261+
* on the target buffer.
262262
*
263263
* Returns the offset number at which the tuple was inserted. This function
264264
* is responsible for preserving the condition that tuples in a hash index

src/backend/access/heap/heapam.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static HeapTuple heap_prepare_insert(Relation relation, HeapTuple tup,
7474
TransactionId xid, CommandId cid, int options);
7575
static XLogRecPtr log_heap_update(Relation reln, Buffer oldbuf,
7676
Buffer newbuf, HeapTuple oldtup,
77-
HeapTuple newtup, HeapTuple old_key_tup,
77+
HeapTuple newtup, HeapTuple old_key_tuple,
7878
bool all_visible_cleared, bool new_all_visible_cleared);
7979
static Bitmapset *HeapDetermineModifiedColumns(Relation relation,
8080
Bitmapset *interesting_cols,

src/backend/access/heap/visibilitymap.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124

125125
/* prototypes for internal routines */
126126
static Buffer vm_readbuf(Relation rel, BlockNumber blkno, bool extend);
127-
static void vm_extend(Relation rel, BlockNumber nvmblocks);
127+
static void vm_extend(Relation rel, BlockNumber vm_nblocks);
128128

129129

130130
/*

src/backend/access/nbtree/nbtsort.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ _bt_blwritepage(BTWriteState *wstate, Page page, BlockNumber blkno)
657657
/* XLOG stuff */
658658
if (wstate->btws_use_wal)
659659
{
660-
/* We use the heap NEWPAGE record type for this */
660+
/* We use the XLOG_FPI record type for this */
661661
log_newpage(&wstate->index->rd_node, MAIN_FORKNUM, blkno, page, true);
662662
}
663663

src/backend/access/transam/README

+1-1
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ void XLogResetInsertion(void)
530530
construction workspace. This is only needed if you have already called
531531
XLogBeginInsert(), but decide to not insert the record after all.
532532

533-
void XLogEnsureRecordSpace(int max_block_id, int nrdatas)
533+
void XLogEnsureRecordSpace(int max_block_id, int ndatas)
534534

535535
Normally, the WAL record construction buffers have the following limits:
536536

src/backend/access/transam/clog.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static int ZeroCLOGPage(int pageno, bool writeXlog);
9292
static bool CLOGPagePrecedes(int page1, int page2);
9393
static void WriteZeroPageXlogRec(int pageno);
9494
static void WriteTruncateXlogRec(int pageno, TransactionId oldestXact,
95-
Oid oldestXidDb);
95+
Oid oldestXactDb);
9696
static void TransactionIdSetPageStatus(TransactionId xid, int nsubxids,
9797
TransactionId *subxids, XidStatus status,
9898
XLogRecPtr lsn, int pageno,

src/backend/access/transam/multixact.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ typedef struct MultiXactStateData
282282
} MultiXactStateData;
283283

284284
/*
285-
* Last element of OldestMemberMXactID and OldestVisibleMXactId arrays.
285+
* Last element of OldestMemberMXactId and OldestVisibleMXactId arrays.
286286
* Valid elements are (1..MaxOldestSlot); element 0 is never used.
287287
*/
288288
#define MaxOldestSlot (MaxBackends + max_prepared_xacts)

src/backend/catalog/aclchk.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -4114,7 +4114,7 @@ pg_largeobject_aclmask_snapshot(Oid lobj_oid, Oid roleid,
41144114
return mask;
41154115

41164116
/*
4117-
* Get the largeobject's ACL from pg_language_metadata
4117+
* Get the largeobject's ACL from pg_largeobject_metadata
41184118
*/
41194119
pg_lo_meta = table_open(LargeObjectMetadataRelationId,
41204120
AccessShareLock);

src/backend/catalog/information_schema.sql

-4
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ CREATE FUNCTION _pg_expandarray(IN anyarray, OUT x anyelement, OUT n int)
4848
pg_catalog.array_upper($1,1),
4949
1) as g(s)';
5050

51-
CREATE FUNCTION _pg_keysequal(smallint[], smallint[]) RETURNS boolean
52-
LANGUAGE sql IMMUTABLE PARALLEL SAFE -- intentionally not STRICT, to allow inlining
53-
AS 'select $1 operator(pg_catalog.<@) $2 and $2 operator(pg_catalog.<@) $1';
54-
5551
/* Given an index's OID and an underlying-table column number, return the
5652
* column's position in the index (NULL if not there) */
5753
CREATE FUNCTION _pg_index_position(oid, smallint) RETURNS int

src/backend/catalog/objectaddress.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ static const ObjectPropertyType ObjectProperty[] =
530530

531531
/*
532532
* This struct maps the string object types as returned by
533-
* getObjectTypeDescription into ObjType enum values. Note that some enum
533+
* getObjectTypeDescription into ObjectType enum values. Note that some enum
534534
* values can be obtained by different names, and that some string object types
535535
* do not have corresponding values in the output enum. The user of this map
536536
* must be careful to test for invalid values being returned.

src/backend/commands/copy.c

-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ typedef struct CopyStateData
176176
* Working state for COPY FROM
177177
*/
178178
AttrNumber num_defaults;
179-
FmgrInfo oid_in_function;
180179
FmgrInfo *in_functions; /* array of input functions for each attrs */
181180
Oid *typioparams; /* array of element types for in_functions */
182181
int *defmap; /* array of default att numbers */

src/backend/commands/define.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ defGetBoolean(DefElem *def)
139139

140140
/*
141141
* The set of strings accepted here should match up with the
142-
* grammar's opt_boolean production.
142+
* grammar's opt_boolean_or_string production.
143143
*/
144144
if (pg_strcasecmp(sval, "true") == 0)
145145
return true;

src/backend/commands/prepare.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ PrepareQuery(PrepareStmt *stmt, const char *queryString,
143143
}
144144

145145
/*
146-
* grammar only allows OptimizableStmt, so this check should be redundant
146+
* grammar only allows PreparableStmt, so this check should be redundant
147147
*/
148148
switch (query->commandType)
149149
{

src/backend/commands/vacuum.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ get_all_vacuum_rels(int options)
847847
}
848848

849849
/*
850-
* vacuum_set_xid_limits() -- compute oldest-Xmin and freeze cutoff points
850+
* vacuum_set_xid_limits() -- compute oldestXmin and freeze cutoff points
851851
*
852852
* The output parameters are:
853853
* - oldestXmin is the cutoff value used to distinguish whether tuples are

src/backend/executor/nodeWindowAgg.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ typedef struct WindowStatePerFuncData
9393
bool resulttypeByVal;
9494

9595
bool plain_agg; /* is it just a plain aggregate function? */
96-
int aggno; /* if so, index of its PerAggData */
96+
int aggno; /* if so, index of its WindowStatePerAggData */
9797

9898
WindowObject winobj; /* object used in window function API */
9999
} WindowStatePerFuncData;
@@ -142,7 +142,7 @@ typedef struct WindowStatePerAggData
142142
resulttypeByVal,
143143
transtypeByVal;
144144

145-
int wfuncno; /* index of associated PerFuncData */
145+
int wfuncno; /* index of associated WindowStatePerFuncData */
146146

147147
/* Context holding transition value and possibly other subsidiary data */
148148
MemoryContext aggcontext; /* may be private, or winstate->aggcontext */

src/backend/libpq/pqcomm.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
* StreamClose - Close a client/backend connection
4545
* TouchSocketFiles - Protect socket files against /tmp cleaners
4646
* pq_init - initialize libpq at backend startup
47-
* pq_comm_reset - reset libpq during error recovery
48-
* pq_close - shutdown libpq at backend exit
47+
* socket_comm_reset - reset libpq during error recovery
48+
* socket_close - shutdown libpq at backend exit
4949
*
5050
* low-level I/O:
5151
* pq_getbytes - get a known number of bytes from connection

src/backend/nodes/params.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ EstimateParamListSpace(ParamListInfo paramLI)
144144
}
145145

146146
/*
147-
* Serialize a paramListInfo structure into caller-provided storage.
147+
* Serialize a ParamListInfo structure into caller-provided storage.
148148
*
149149
* We write the number of parameters first, as a 4-byte integer, and then
150150
* write details for each parameter in turn. The details for each parameter

src/backend/nodes/tidbitmap.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ tbm_iterate(TBMIterator *iterator)
10211021
PagetableEntry *page;
10221022
int ntuples;
10231023

1024-
/* In ONE_PAGE state, we don't allocate an spages[] array */
1024+
/* In TBM_ONE_PAGE state, we don't allocate an spages[] array */
10251025
if (tbm->status == TBM_ONE_PAGE)
10261026
page = &tbm->entry1;
10271027
else

src/backend/optimizer/geqo/geqo_selection.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ geqo_selection(PlannerInfo *root, Chromosome *momma, Chromosome *daddy,
9191
static int
9292
linear_rand(PlannerInfo *root, int pool_size, double bias)
9393
{
94-
double index; /* index between 0 and pop_size */
94+
double index; /* index between 0 and pool_size */
9595
double max = (double) pool_size;
9696

9797
/*

src/backend/optimizer/plan/planner.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -4242,7 +4242,7 @@ consider_groupingsets_paths(PlannerInfo *root,
42424242
* 2) If there are no empty sets and only unsortable sets, then the
42434243
* rollups list will be empty (and thus l_start == NULL), and
42444244
* group_pathkeys will be NIL; we must ensure that the vacuously-true
4245-
* pathkeys_contain_in test doesn't cause us to crash.
4245+
* pathkeys_contained_in test doesn't cause us to crash.
42464246
*/
42474247
if (l_start != NULL &&
42484248
pathkeys_contained_in(root->group_pathkeys, path->pathkeys))
@@ -5177,7 +5177,7 @@ make_group_input_target(PlannerInfo *root, PathTarget *final_target)
51775177
* a regular aggregation node would, plus any aggregates used in HAVING;
51785178
* except that the Aggref nodes should be marked as partial aggregates.
51795179
*
5180-
* In addition, we'd better emit any Vars and PlaceholderVars that are
5180+
* In addition, we'd better emit any Vars and PlaceHolderVars that are
51815181
* used outside of Aggrefs in the aggregation tlist and HAVING. (Presumably,
51825182
* these would be Vars that are grouped by or used in grouping expressions.)
51835183
*

src/backend/parser/parse_oper.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ LookupOperName(ParseState *pstate, List *opername, Oid oprleft, Oid oprright,
134134
/*
135135
* LookupOperWithArgs
136136
* Like LookupOperName, but the argument types are specified by
137-
* a ObjectWithArg node.
137+
* a ObjectWithArgs node.
138138
*/
139139
Oid
140140
LookupOperWithArgs(ObjectWithArgs *oper, bool noError)

src/backend/postmaster/pgstat.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -6122,7 +6122,7 @@ pgstat_recv_resetcounter(PgStat_MsgResetcounter *msg, int len)
61226122
}
61236123

61246124
/* ----------
6125-
* pgstat_recv_resetshared() -
6125+
* pgstat_recv_resetsharedcounter() -
61266126
*
61276127
* Reset some shared statistics of the cluster.
61286128
* ----------

src/backend/regex/regcomp.c

-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ struct vars
288288
#define NWBDRY 'W' /* non-word-boundary constraint */
289289
#define SBEGIN 'A' /* beginning of string (even if not BOL) */
290290
#define SEND 'Z' /* end of string (even if not EOL) */
291-
#define PREFER 'P' /* length preference */
292291

293292
/* is an arc colored, and hence on a color chain? */
294293
#define COLORED(a) \

src/backend/replication/logical/reorderbuffer.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1381,7 +1381,7 @@ ReorderBufferCopySnap(ReorderBuffer *rb, Snapshot orig_snap,
13811381
snap->subxip[i++] = txn->xid;
13821382

13831383
/*
1384-
* nsubxcnt isn't decreased when subtransactions abort, so count manually.
1384+
* subxcnt isn't decreased when subtransactions abort, so count manually.
13851385
* Since it's an upper boundary it is safe to use it for the allocation
13861386
* above.
13871387
*/

src/backend/storage/ipc/procarray.c

-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ CreateSharedProcArray(void)
265265
&found);
266266
}
267267

268-
/* Register and initialize fields of ProcLWLockTranche */
269268
LWLockRegisterTranche(LWTRANCHE_PROC, "proc");
270269
}
271270

0 commit comments

Comments
 (0)