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

Commit 66bde49

Browse files
committed
Fix inconsistencies and typos in the tree, take 10
This addresses some issues with unnecessary code comments, fixes various typos in docs and comments, and removes some orphaned structures and definitions. Author: Alexander Lakhin Discussion: https://postgr.es/m/9aabc775-5494-b372-8bcb-4dfc0bd37c68@gmail.com
1 parent 2d7d67c commit 66bde49

Some content is hidden

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

74 files changed

+93
-141
lines changed

contrib/fuzzystrmatch/dmetaphone.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ dmetaphone_alt(PG_FUNCTION_ARGS)
191191
(v = (t*)repalloc((v),((n)*sizeof(t))))
192192

193193
/*
194-
* Don't do pfree - it seems to cause a segv sometimes - which might have just
194+
* Don't do pfree - it seems to cause a SIGSEGV sometimes - which might have just
195195
* been caused by reloading the module in development.
196196
* So we rely on context cleanup - Tom Lane says pfree shouldn't be necessary
197197
* in a case like this.

contrib/ltree/ltxtquery_io.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ pushquery(QPRS_STATE *state, int32 type, int32 val, int32 distance, int32 lenval
166166
}
167167

168168
/*
169-
* This function is used for query_txt parsing
169+
* This function is used for query text parsing
170170
*/
171171
static void
172172
pushval_asis(QPRS_STATE *state, int type, char *strval, int lenval, uint16 flag)

contrib/pgcrypto/internal.c

-19
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,6 @@
3939
#include "blf.h"
4040
#include "rijndael.h"
4141

42-
/*
43-
* System reseeds should be separated at least this much.
44-
*/
45-
#define SYSTEM_RESEED_MIN (20*60) /* 20 min */
46-
/*
47-
* How often to roll dice.
48-
*/
49-
#define SYSTEM_RESEED_CHECK_TIME (10*60) /* 10 min */
50-
/*
51-
* The chance is x/256 that the reseed happens.
52-
*/
53-
#define SYSTEM_RESEED_CHANCE (4) /* 256/4 * 10min ~ 10h */
54-
55-
/*
56-
* If this much time has passed, force reseed.
57-
*/
58-
#define SYSTEM_RESEED_MAX (12*60*60) /* 12h */
59-
60-
6142
#ifndef MD5_DIGEST_LENGTH
6243
#define MD5_DIGEST_LENGTH 16
6344
#endif

contrib/pgcrypto/pgp-decrypt.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ static struct PullFilterOps mdc_filter = {
423423
/*
424424
* Combined Pkt reader and MDC hasher.
425425
*
426-
* For the case of SYMENCRYPTED_MDC packet, where
426+
* For the case of SYMENCRYPTED_DATA_MDC packet, where
427427
* the data part has 'context length', which means
428428
* that data packet ends 22 bytes before end of parent
429429
* packet, which is silly.
@@ -894,7 +894,10 @@ process_data_packets(PGP_Context *ctx, MBuf *dst, PullFilter *src,
894894
break;
895895
}
896896

897-
/* context length inside SYMENC_MDC needs special handling */
897+
/*
898+
* Context length inside SYMENCRYPTED_DATA_MDC packet needs special
899+
* handling.
900+
*/
898901
if (need_mdc && res == PKT_CONTEXT)
899902
res = pullf_create(&pkt, &mdcbuf_filter, ctx, src);
900903
else

contrib/pgcrypto/pgp-encrypt.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ pgp_encrypt(PGP_Context *ctx, MBuf *src, MBuf *dst)
618618
goto out;
619619

620620
/*
621-
* initialize symkey
621+
* initialize sym_key
622622
*/
623623
if (ctx->sym_key)
624624
{

contrib/pgcrypto/pgp.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ int pgp_s2k_process(PGP_S2K *s2k, int cipher, const uint8 *key, int klen);
279279

280280
typedef struct PGP_CFB PGP_CFB;
281281
int pgp_cfb_create(PGP_CFB **ctx_p, int algo,
282-
const uint8 *key, int key_len, int recync, uint8 *iv);
282+
const uint8 *key, int key_len, int resync, uint8 *iv);
283283
void pgp_cfb_free(PGP_CFB *ctx);
284284
int pgp_cfb_encrypt(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst);
285285
int pgp_cfb_decrypt(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst);

contrib/sepgsql/label.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ sepgsql_mcstrans_out(PG_FUNCTION_ARGS)
653653
}
654654

655655
/*
656-
* quote_object_names
656+
* quote_object_name
657657
*
658658
* It tries to quote the supplied identifiers
659659
*/

contrib/sepgsql/selinux.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -657,10 +657,8 @@ sepgsql_getenforce(void)
657657
/*
658658
* sepgsql_audit_log
659659
*
660-
* It generates a security audit record. In the default, it writes out
661-
* audit records into standard PG's logfile. It also allows to set up
662-
* external audit log receiver, such as auditd in Linux, using the
663-
* sepgsql_audit_hook.
660+
* It generates a security audit record. It writes out audit records
661+
* into standard PG's logfile.
664662
*
665663
* SELinux can control what should be audited and should not using
666664
* "auditdeny" and "auditallow" rules in the security policy. In the

contrib/spi/refint.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CREATE TABLE A (
55
);
66
CREATE UNIQUE INDEX AI ON A (ID);
77

8-
--Columns REFB of table B and REFC of C are foreign keys referenting ID of A:
8+
--Columns REFB of table B and REFC of C are foreign keys referencing ID of A:
99

1010
CREATE TABLE B (
1111
REFB int4

doc/src/sgml/ecpg.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5011,7 +5011,7 @@ struct
50115011

50125012
<para>
50135013
The fields <structfield>sqlcaid</structfield>,
5014-
<structfield>sqlcabc</structfield>,
5014+
<structfield>sqlabc</structfield>,
50155015
<structfield>sqlerrp</structfield>, and the remaining elements of
50165016
<structfield>sqlerrd</structfield> and
50175017
<structfield>sqlwarn</structfield> currently contain no useful

doc/src/sgml/plpgsql.sgml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3740,9 +3740,9 @@ RAISE unique_violation USING MESSAGE = 'Duplicate user ID: ' || user_id;
37403740
<para>
37413741
If no condition name nor SQLSTATE is specified in a
37423742
<command>RAISE EXCEPTION</command> command, the default is to use
3743-
<literal>RAISE_EXCEPTION</literal> (<literal>P0001</literal>). If no message
3744-
text is specified, the default is to use the condition name or
3745-
SQLSTATE as message text.
3743+
<literal>ERRCODE_RAISE_EXCEPTION</literal> (<literal>P0001</literal>).
3744+
If no message text is specified, the default is to use the condition
3745+
name or SQLSTATE as message text.
37463746
</para>
37473747

37483748
<note>
@@ -5626,7 +5626,7 @@ BEGIN
56265626
INSERT INTO cs_active_job(job_id) VALUES (v_job_id);
56275627

56285628
BEGIN
5629-
INSERT INTO cs_jobs (job_id, start_stamp) VALUES (v_job_id, sysdate);
5629+
INSERT INTO cs_jobs (job_id, start_stamp) VALUES (v_job_id, now());
56305630
EXCEPTION
56315631
WHEN dup_val_on_index THEN NULL; -- don't worry if it already exists
56325632
END;

doc/src/sgml/sources.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ BETTER: unrecognized node type: 42
884884
features can be used, if a fallback is provided.
885885
</para>
886886
<para>
887-
For example <literal>_StaticAssert()</literal> and
887+
For example <literal>_Static_assert()</literal> and
888888
<literal>__builtin_constant_p</literal> are currently used, even though
889889
they are from newer revisions of the C standard and a
890890
<productname>GCC</productname> extension respectively. If not available

src/backend/access/brin/brin_revmap.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,10 @@ brinRevmapDesummarizeRange(Relation idxrel, BlockNumber heapBlk)
395395
*/
396396

397397
/*
398-
* Because of SUE lock, this function shouldn't run concurrently with
399-
* summarization. Placeholder tuples can only exist as leftovers from
400-
* crashed summarization, so if we detect any, we complain but proceed.
398+
* Because of ShareUpdateExclusive lock, this function shouldn't run
399+
* concurrently with summarization. Placeholder tuples can only exist as
400+
* leftovers from crashed summarization, so if we detect any, we complain
401+
* but proceed.
401402
*/
402403
if (BrinTupleIsPlaceholder(tup))
403404
ereport(WARNING,

src/backend/access/gist/gist.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static bool gistinserttuples(GISTInsertState *state, GISTInsertStack *stack,
3737
Buffer leftchild, Buffer rightchild,
3838
bool unlockbuf, bool unlockleftchild);
3939
static void gistfinishsplit(GISTInsertState *state, GISTInsertStack *stack,
40-
GISTSTATE *giststate, List *splitinfo, bool releasebuf);
40+
GISTSTATE *giststate, List *splitinfo, bool unlockbuf);
4141
static void gistprunepage(Relation rel, Page page, Buffer buffer,
4242
Relation heapRel);
4343

@@ -1047,7 +1047,7 @@ gistFindCorrectParent(Relation r, GISTInsertStack *child)
10471047
{
10481048
/*
10491049
* End of chain and still didn't find parent. It's a very-very
1050-
* rare situation when root splited.
1050+
* rare situation when root splitted.
10511051
*/
10521052
break;
10531053
}

src/backend/access/hash/hashpage.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,7 @@ _hash_getcachedmetap(Relation rel, Buffer *metabuf, bool force_refresh)
15101510
* It's important that we don't set rd_amcache to an invalid value.
15111511
* Either MemoryContextAlloc or _hash_getbuf could fail, so don't
15121512
* install a pointer to the newly-allocated storage in the actual
1513-
* relcache entry until both have succeeeded.
1513+
* relcache entry until both have succeeded.
15141514
*/
15151515
if (rel->rd_amcache == NULL)
15161516
cache = MemoryContextAlloc(rel->rd_indexcxt,

src/backend/access/heap/heapam.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3029,7 +3029,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
30293029
* the value ends up being the same, this test will fail and we will use
30303030
* the stronger lock. This is acceptable; the important case to optimize
30313031
* is updates that don't manipulate key columns, not those that
3032-
* serendipitiously arrive at the same key values.
3032+
* serendipitously arrive at the same key values.
30333033
*/
30343034
if (!bms_overlap(modified_attrs, key_attrs))
30353035
{

src/backend/access/nbtree/nbtutils.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ _bt_restore_array_keys(IndexScanDesc scan)
664664
* scan->numberOfKeys is the number of input keys, so->numberOfKeys gets
665665
* the number of output keys (possibly less, never greater).
666666
*
667-
* The output keys are marked with additional sk_flag bits beyond the
667+
* The output keys are marked with additional sk_flags bits beyond the
668668
* system-standard bits supplied by the caller. The DESC and NULLS_FIRST
669669
* indoption bits for the relevant index attribute are copied into the flags.
670670
* Also, for a DESC column, we commute (flip) all the sk_strategy numbers

src/backend/access/transam/slru.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,7 @@ SlruScanDirCbDeleteAll(SlruCtl ctl, char *filename, int segpage, void *data)
13641364
}
13651365

13661366
/*
1367-
* Scan the SimpleLRU directory and apply a callback to each file found in it.
1367+
* Scan the SimpleLru directory and apply a callback to each file found in it.
13681368
*
13691369
* If the callback returns true, the scan is stopped. The last return value
13701370
* from the callback is returned.

src/backend/access/transam/xact.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,7 @@ RecordTransactionCommit(void)
12321232
if (!markXidCommitted)
12331233
{
12341234
/*
1235-
* We expect that every smgrscheduleunlink is followed by a catalog
1235+
* We expect that every RelationDropStorage is followed by a catalog
12361236
* update, and hence XID assignment, so we shouldn't get here with any
12371237
* pending deletes. Use a real test not just an Assert to check this,
12381238
* since it's a bit fragile.

src/backend/access/transam/xlogreader.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr,
702702
* We assume all of the record (that is, xl_tot_len bytes) has been read
703703
* into memory at *record. Also, ValidXLogRecordHeader() has accepted the
704704
* record's header, which means in particular that xl_tot_len is at least
705-
* SizeOfXlogRecord.
705+
* SizeOfXLogRecord.
706706
*/
707707
static bool
708708
ValidXLogRecord(XLogReaderState *state, XLogRecord *record, XLogRecPtr recptr)

src/backend/catalog/catalog.c

-7
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,6 @@ IsSharedRelation(Oid relationId)
317317
* consecutive existing OIDs. This is a mostly reasonable assumption for
318318
* system catalogs.
319319
*
320-
* This is exported separately because there are cases where we want to use
321-
* an index that will not be recognized by RelationGetOidIndex: TOAST tables
322-
* have indexes that are usable, but have multiple columns and are on
323-
* ordinary columns rather than a true OID column. This code will work
324-
* anyway, so long as the OID is the index's first column. The caller must
325-
* pass in the actual heap attnum of the OID column, however.
326-
*
327320
* Caller must have a suitable lock on the relation.
328321
*/
329322
Oid

src/backend/catalog/pg_constraint.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ RemoveConstraintById(Oid conId)
580580
rel = table_open(con->conrelid, AccessExclusiveLock);
581581

582582
/*
583-
* We need to update the relcheck count if it is a check constraint
583+
* We need to update the relchecks count if it is a check constraint
584584
* being dropped. This update will force backends to rebuild relcache
585585
* entries when we commit.
586586
*/

src/backend/commands/cluster.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
15221522

15231523
/*
15241524
* Get a list of tables that the current user owns and
1525-
* have indisclustered set. Return the list in a List * of rvsToCluster
1525+
* have indisclustered set. Return the list in a List * of RelToCluster
15261526
* with the tableOid and the indexOid on which the table is already
15271527
* clustered.
15281528
*/

src/backend/commands/sequence.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ init_sequence(Oid relid, SeqTable *p_elm, Relation *p_rel)
11151115
/*
11161116
* Initialize the new hash table entry if it did not exist already.
11171117
*
1118-
* NOTE: seqtable entries are stored for the life of a backend (unless
1118+
* NOTE: seqhashtab entries are stored for the life of a backend (unless
11191119
* explicitly discarded with DISCARD). If the sequence itself is deleted
11201120
* then the entry becomes wasted memory, but it's small enough that this
11211121
* should not matter.

src/backend/executor/spi.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -2603,7 +2603,7 @@ _SPI_cursor_operation(Portal portal, FetchDirection direction, long count,
26032603

26042604
/*
26052605
* Think not to combine this store with the preceding function call. If
2606-
* the portal contains calls to functions that use SPI, then SPI_stack is
2606+
* the portal contains calls to functions that use SPI, then _SPI_stack is
26072607
* likely to move around while the portal runs. When control returns,
26082608
* _SPI_current will point to the correct stack entry... but the pointer
26092609
* may be different than it was beforehand. So we must be sure to re-fetch
@@ -2733,7 +2733,7 @@ _SPI_make_plan_non_temp(SPIPlanPtr plan)
27332733
ALLOCSET_SMALL_SIZES);
27342734
oldcxt = MemoryContextSwitchTo(plancxt);
27352735

2736-
/* Copy the SPI_plan struct and subsidiary data into the new context */
2736+
/* Copy the _SPI_plan struct and subsidiary data into the new context */
27372737
newplan = (SPIPlanPtr) palloc0(sizeof(_SPI_plan));
27382738
newplan->magic = _SPI_PLAN_MAGIC;
27392739
newplan->plancxt = plancxt;

src/backend/libpq/auth.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1797,7 +1797,7 @@ interpret_ident_response(const char *ident_response,
17971797
/*
17981798
* Talk to the ident server on "remote_addr" and find out who
17991799
* owns the tcp connection to "local_addr"
1800-
* It the username successfully retrieved, check the usermap.
1800+
* If the username is successfully retrieved, check the usermap.
18011801
*
18021802
* XXX: Using WaitLatchOrSocket() and doing a CHECK_FOR_INTERRUPTS() if the
18031803
* latch was set would improve the responsiveness to timeouts/cancellations.

src/backend/libpq/pqcomm.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -485,10 +485,10 @@ StreamServerPort(int family, char *hostName, unsigned short portNumber,
485485
* error on TCP ports.
486486
*
487487
* On win32, however, this behavior only happens if the
488-
* SO_EXLUSIVEADDRUSE is set. With SO_REUSEADDR, win32 allows multiple
489-
* servers to listen on the same address, resulting in unpredictable
490-
* behavior. With no flags at all, win32 behaves as Unix with
491-
* SO_REUSEADDR.
488+
* SO_EXCLUSIVEADDRUSE is set. With SO_REUSEADDR, win32 allows
489+
* multiple servers to listen on the same address, resulting in
490+
* unpredictable behavior. With no flags at all, win32 behaves as Unix
491+
* with SO_REUSEADDR.
492492
*/
493493
if (!IS_AF_UNIX(addr->ai_family))
494494
{

src/backend/optimizer/path/costsize.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1811,7 +1811,7 @@ append_nonpartial_cost(List *subpaths, int numpaths, int parallel_workers)
18111811
return 0;
18121812

18131813
/*
1814-
* Array length is number of workers or number of relevants paths,
1814+
* Array length is number of workers or number of relevant paths,
18151815
* whichever is less.
18161816
*/
18171817
arrlen = Min(parallel_workers, numpaths);

src/backend/partitioning/partbounds.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,7 @@ partition_rbound_cmp(int partnatts, FmgrInfo *partsupfunc,
15141514
/*
15151515
* partition_rbound_datum_cmp
15161516
*
1517-
* Return whether range bound (specified in rb_datums, rb_kind, and rb_lower)
1517+
* Return whether range bound (specified in rb_datums and rb_kind)
15181518
* is <, =, or > partition key of tuple (tuple_datums)
15191519
*
15201520
* n_tuple_datums, partsupfunc and partcollation give number of attributes in

src/backend/partitioning/partprune.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@ match_clause_to_partition_key(GeneratePruningStepsContext *context,
21272127

21282128
/*
21292129
* Now generate a list of clauses, one for each array element, of the
2130-
* form saop_leftop saop_op elem_expr
2130+
* form leftop saop_op elem_expr
21312131
*/
21322132
elem_clauses = NIL;
21332133
foreach(lc1, elem_exprs)

src/backend/port/posix_sema.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ PGSemaphoreShmemSize(int maxSemas)
189189
* maxSemas parameter is just used to size the arrays. For unnamed
190190
* semaphores, there is an array of PGSemaphoreData structs in shared memory.
191191
* For named semaphores, we keep a postmaster-local array of sem_t pointers,
192-
* which we use for releasing the semphores when done.
192+
* which we use for releasing the semaphores when done.
193193
* (This design minimizes the dependency of postmaster shutdown on the
194194
* contents of shared memory, which a failed backend might have clobbered.
195195
* We can't do much about the possibility of sem_destroy() crashing, but

src/backend/port/win32/signal.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pgwin32_signal_initialize(void)
102102
/*
103103
* Dispatch all signals currently queued and not blocked
104104
* Blocked signals are ignored, and will be fired at the time of
105-
* the sigsetmask() call.
105+
* the pqsigsetmask() call.
106106
*/
107107
void
108108
pgwin32_dispatch_queued_signals(void)

src/backend/postmaster/checkpointer.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ IsCheckpointOnSchedule(double progress)
750750
* We compare the current WAL insert location against the location
751751
* computed before calling CreateCheckPoint. The code in XLogInsert that
752752
* actually triggers a checkpoint when CheckPointSegments is exceeded
753-
* compares against RedoRecptr, so this is not completely accurate.
753+
* compares against RedoRecPtr, so this is not completely accurate.
754754
* However, it's good enough for our purposes, we're only calculating an
755755
* estimate anyway.
756756
*

src/backend/replication/basebackup.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ SendBackupHeader(List *tablespaces)
792792
pq_sendint32(&buf, 0); /* typmod */
793793
pq_sendint16(&buf, 0); /* format code */
794794

795-
/* Second field - spcpath */
795+
/* Second field - spclocation */
796796
pq_sendstring(&buf, "spclocation");
797797
pq_sendint32(&buf, 0);
798798
pq_sendint16(&buf, 0);

src/backend/replication/logical/snapbuild.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static void SnapBuildSnapIncRefcount(Snapshot snap);
269269

270270
static void SnapBuildDistributeNewCatalogSnapshot(SnapBuild *builder, XLogRecPtr lsn);
271271

272-
/* xlog reading helper functions for SnapBuildProcessRecord */
272+
/* xlog reading helper functions for SnapBuildProcessRunningXacts */
273273
static bool SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *running);
274274
static void SnapBuildWaitSnapshot(xl_running_xacts *running, TransactionId cutoff);
275275

0 commit comments

Comments
 (0)