1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Turn a few 'validnsps' static variables into locals

There was no need for these to be static buffers, local variables work
just as well. I think they were marked as 'static' to imply that they
are read-only, but 'const' is more appropriate for that, so change
them to const.

To make it possible to mark the variables as 'const', also add 'const'
decorations to the transformRelOptions() signature.

Reviewed-by: Andres Freund
Discussion: https://www.postgresql.org/message-id/54c29fb0-edf2-48ea-9814-44e918bbd6e8@iki.fi
This commit is contained in:
Heikki Linnakangas
2024-08-06 23:03:43 +03:00
parent a890ad2149
commit 1e35951e71
5 changed files with 6 additions and 6 deletions

View File

@ -1154,7 +1154,7 @@ add_local_string_reloption(local_relopts *relopts, const char *name,
*/ */
Datum Datum
transformRelOptions(Datum oldOptions, List *defList, const char *namspace, transformRelOptions(Datum oldOptions, List *defList, const char *namspace,
char *validnsps[], bool acceptOidsOff, bool isReset) const char *const validnsps[], bool acceptOidsOff, bool isReset)
{ {
Datum result; Datum result;
ArrayBuildState *astate; ArrayBuildState *astate;

View File

@ -83,7 +83,7 @@ create_ctas_internal(List *attrList, IntoClause *into)
bool is_matview; bool is_matview;
char relkind; char relkind;
Datum toast_options; Datum toast_options;
static char *validnsps[] = HEAP_RELOPT_NAMESPACES; const char *const validnsps[] = HEAP_RELOPT_NAMESPACES;
ObjectAddress intoRelationAddr; ObjectAddress intoRelationAddr;
/* This code supports both CREATE TABLE AS and CREATE MATERIALIZED VIEW */ /* This code supports both CREATE TABLE AS and CREATE MATERIALIZED VIEW */

View File

@ -700,7 +700,7 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
ListCell *listptr; ListCell *listptr;
AttrNumber attnum; AttrNumber attnum;
bool partitioned; bool partitioned;
static char *validnsps[] = HEAP_RELOPT_NAMESPACES; const char *const validnsps[] = HEAP_RELOPT_NAMESPACES;
Oid ofTypeId; Oid ofTypeId;
ObjectAddress address; ObjectAddress address;
LOCKMODE parentLockmode; LOCKMODE parentLockmode;
@ -14897,7 +14897,7 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
Datum repl_val[Natts_pg_class]; Datum repl_val[Natts_pg_class];
bool repl_null[Natts_pg_class]; bool repl_null[Natts_pg_class];
bool repl_repl[Natts_pg_class]; bool repl_repl[Natts_pg_class];
static char *validnsps[] = HEAP_RELOPT_NAMESPACES; const char *const validnsps[] = HEAP_RELOPT_NAMESPACES;
if (defList == NIL && operation != AT_ReplaceRelOptions) if (defList == NIL && operation != AT_ReplaceRelOptions)
return; /* nothing to do */ return; /* nothing to do */

View File

@ -1155,7 +1155,7 @@ ProcessUtilitySlow(ParseState *pstate,
{ {
CreateStmt *cstmt = (CreateStmt *) stmt; CreateStmt *cstmt = (CreateStmt *) stmt;
Datum toast_options; Datum toast_options;
static char *validnsps[] = HEAP_RELOPT_NAMESPACES; const char *const validnsps[] = HEAP_RELOPT_NAMESPACES;
/* Remember transformed RangeVar for LIKE */ /* Remember transformed RangeVar for LIKE */
table_rv = cstmt->relation; table_rv = cstmt->relation;

View File

@ -220,7 +220,7 @@ extern void add_local_string_reloption(local_relopts *relopts, const char *name,
fill_string_relopt filler, int offset); fill_string_relopt filler, int offset);
extern Datum transformRelOptions(Datum oldOptions, List *defList, extern Datum transformRelOptions(Datum oldOptions, List *defList,
const char *namspace, char *validnsps[], const char *namspace, const char *const validnsps[],
bool acceptOidsOff, bool isReset); bool acceptOidsOff, bool isReset);
extern List *untransformRelOptions(Datum options); extern List *untransformRelOptions(Datum options);
extern bytea *extractRelOptions(HeapTuple tuple, TupleDesc tupdesc, extern bytea *extractRelOptions(HeapTuple tuple, TupleDesc tupdesc,