Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit095d109

Browse files
committed
Remove redundant setting of hashkey after insertion
It's not necessary to fill the key field in most cases, sincehash_search has already done that. Some existing call sites have anassert or comment that this contract has been fulfilled, but thoseare quite old and that practice seems unnecessary here.While at it, remove a nearby redundant assignment that a smart compilerwill elide anyway.Zhao Junwang, with some adjustments by meReviewed by Nathan Bossart, with additional feedback from Tom LaneDiscussion:http://postgr.es/m/CAEG8a3%2BUPF%3DR2QGPgJMF2mKh8xPd1H2TmfH77zPuVUFdBpiGUA%40mail.gmail.com
1 parent489ca33 commit095d109

File tree

5 files changed

+8
-18
lines changed

5 files changed

+8
-18
lines changed

‎contrib/dblink/dblink.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2574,7 +2574,6 @@ createNewConnection(const char *name, remoteConn *rconn)
25742574
}
25752575

25762576
hentry->rconn=rconn;
2577-
strlcpy(hentry->name,name,sizeof(hentry->name));
25782577
}
25792578

25802579
staticvoid

‎src/backend/commands/async.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2305,15 +2305,13 @@ AddEventToPendingNotifies(Notification *n)
23052305
foreach(l,pendingNotifies->events)
23062306
{
23072307
Notification*oldn= (Notification*)lfirst(l);
2308-
NotificationHash*hentry;
23092308
boolfound;
23102309

2311-
hentry= (NotificationHash*)hash_search(pendingNotifies->hashtab,
2312-
&oldn,
2313-
HASH_ENTER,
2314-
&found);
2310+
(void)hash_search(pendingNotifies->hashtab,
2311+
&oldn,
2312+
HASH_ENTER,
2313+
&found);
23152314
Assert(!found);
2316-
hentry->event=oldn;
23172315
}
23182316
}
23192317

@@ -2323,15 +2321,13 @@ AddEventToPendingNotifies(Notification *n)
23232321
/* Add event to the hash table if needed */
23242322
if (pendingNotifies->hashtab!=NULL)
23252323
{
2326-
NotificationHash*hentry;
23272324
boolfound;
23282325

2329-
hentry= (NotificationHash*)hash_search(pendingNotifies->hashtab,
2330-
&n,
2331-
HASH_ENTER,
2332-
&found);
2326+
(void)hash_search(pendingNotifies->hashtab,
2327+
&n,
2328+
HASH_ENTER,
2329+
&found);
23332330
Assert(!found);
2334-
hentry->event=n;
23352331
}
23362332
}
23372333

‎src/backend/commands/tablecmds.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,10 +2104,7 @@ ExecuteTruncateGuts(List *explicit_rels,
21042104
/* Find or create cached entry for the foreign table */
21052105
ft_info = hash_search(ft_htab, &serverid, HASH_ENTER, &found);
21062106
if (!found)
2107-
{
2108-
ft_info->serverid = serverid;
21092107
ft_info->rels = NIL;
2110-
}
21112108

21122109
/*
21132110
* Save the foreign table in the entry of the server that the

‎src/backend/replication/logical/applyparallelworker.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,6 @@ pa_allocate_worker(TransactionId xid)
509509
winfo->in_use= true;
510510
winfo->serialize_changes= false;
511511
entry->winfo=winfo;
512-
entry->xid=xid;
513512
}
514513

515514
/*

‎src/backend/replication/logical/relation.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,6 @@ logicalrep_partition_open(LogicalRepRelMapEntry *root,
657657
inti;
658658

659659
/* Remote relation is copied as-is from the root entry. */
660-
entry=&part_entry->relmapentry;
661660
entry->remoterel.remoteid=remoterel->remoteid;
662661
entry->remoterel.nspname=pstrdup(remoterel->nspname);
663662
entry->remoterel.relname=pstrdup(remoterel->relname);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp