Skip to content

Commit b6f7df2

Browse files
JelteFCommitfest Bot
authored andcommitted
Inline functions that have now become trivial
1 parent d109386 commit b6f7df2

File tree

3 files changed

+10
-45
lines changed

3 files changed

+10
-45
lines changed

src/backend/commands/prepare.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
*/
4747
static HTAB *prepared_queries = NULL;
4848

49-
static void InitQueryHashTable(void);
5049
static ParamListInfo EvaluateParams(ParseState *pstate,
5150
PreparedStatement *pstmt, List *params,
5251
EState *estate);
@@ -364,18 +363,6 @@ EvaluateParams(ParseState *pstate, PreparedStatement *pstmt, List *params,
364363
return paramLI;
365364
}
366365

367-
368-
/*
369-
* Initialize query hash table upon first use.
370-
*/
371-
static void
372-
InitQueryHashTable(void)
373-
{
374-
prepared_queries = hash_make_cxt(PreparedStatement, stmt_name,
375-
"Prepared Queries", 32,
376-
TopMemoryContext);
377-
}
378-
379366
/*
380367
* Store all the data pertaining to a query in the hash table using
381368
* the specified key. The passed CachedPlanSource should be "unsaved"
@@ -393,7 +380,9 @@ StorePreparedStatement(const char *stmt_name,
393380

394381
/* Initialize the hash table, if necessary */
395382
if (!prepared_queries)
396-
InitQueryHashTable();
383+
prepared_queries = hash_make_cxt(PreparedStatement, stmt_name,
384+
"Prepared Queries", 32,
385+
TopMemoryContext);
397386

398387
/* Add entry to hash table */
399388
entry = (PreparedStatement *) hash_search(prepared_queries,

src/backend/commands/sequence.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ static SeqTableData *last_used_seq = NULL;
8989
static void fill_seq_with_data(Relation rel, HeapTuple tuple);
9090
static void fill_seq_fork_with_data(Relation rel, HeapTuple tuple, ForkNumber forkNum);
9191
static Relation lock_and_open_sequence(SeqTable seq);
92-
static void create_seq_hashtable(void);
9392
static void init_sequence(Oid relid, SeqTable *p_elm, Relation *p_rel);
9493
static Form_pg_sequence_data read_seq_tuple(Relation rel,
9594
Buffer *buf, HeapTuple seqdatatuple);
@@ -1107,17 +1106,6 @@ lock_and_open_sequence(SeqTable seq)
11071106
return sequence_open(seq->relid, NoLock);
11081107
}
11091108

1110-
/*
1111-
* Creates the hash table for storing sequence data
1112-
*/
1113-
static void
1114-
create_seq_hashtable(void)
1115-
{
1116-
seqhashtab = hash_make_cxt(SeqTableData, relid,
1117-
"Sequence values", 16,
1118-
TopMemoryContext);
1119-
}
1120-
11211109
/*
11221110
* Given a relation OID, open and lock the sequence. p_elm and p_rel are
11231111
* output parameters.
@@ -1131,7 +1119,9 @@ init_sequence(Oid relid, SeqTable *p_elm, Relation *p_rel)
11311119

11321120
/* Find or create a hash table entry for this sequence */
11331121
if (seqhashtab == NULL)
1134-
create_seq_hashtable();
1122+
seqhashtab = hash_make_cxt(SeqTableData, relid,
1123+
"Sequence values", 16,
1124+
TopMemoryContext);
11351125

11361126
elm = (SeqTable) hash_search(seqhashtab, &relid, HASH_ENTER, &found);
11371127

src/backend/utils/cache/funccache.c

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,6 @@ static uint32 cfunc_hash(const void *key, Size keysize);
5050
static int cfunc_match(const void *key1, const void *key2, Size keysize);
5151

5252

53-
/*
54-
* Initialize the hash table on first use.
55-
*
56-
* The hash table will be in TopMemoryContext regardless of caller's context.
57-
*/
58-
static void
59-
cfunc_hashtable_init(void)
60-
{
61-
/* don't allow double-initialization */
62-
Assert(cfunc_hashtable == NULL);
63-
64-
cfunc_hashtable = hash_make_fn_cxt(CachedFunctionHashEntry, key,
65-
"Cached function hash", FUNCS_PER_USER,
66-
cfunc_hash, cfunc_match,
67-
TopMemoryContext);
68-
}
69-
7053
/*
7154
* cfunc_hash: hash function for cfunc hash table
7255
*
@@ -165,7 +148,10 @@ cfunc_hashtable_insert(CachedFunction *function,
165148
bool found;
166149

167150
if (cfunc_hashtable == NULL)
168-
cfunc_hashtable_init();
151+
cfunc_hashtable = hash_make_fn_cxt(CachedFunctionHashEntry, key,
152+
"Cached function hash", FUNCS_PER_USER,
153+
cfunc_hash, cfunc_match,
154+
TopMemoryContext);
169155

170156
hentry = (CachedFunctionHashEntry *) hash_search(cfunc_hashtable,
171157
func_key,

0 commit comments

Comments
 (0)