Skip to content

Commit d0e4083

Browse files
pg_upgrade: Avoid shadowing global var in function
The new_cluster parameter in check_for_new_tablespace_dir was shadowing the globally defined new_cluster variable, causing compiler warnings when running with -Wshadow. The function is only applicable to the new cluster, so remove the parameter rather than rename to match check_new_cluster_is_empty which also only applies to the new cluster. Author: Peter Smith <peter.b.smith@fujitsu.com> Discussion: https://postgr.es/m/CAHut+PvS_PHLntWy1yTgXv0O1tWm4iVcKBQFzpoQRDsm2Ce_Fg@mail.gmail.com
1 parent ed057fb commit d0e4083

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/bin/pg_upgrade/check.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static void check_for_reg_data_type_usage(ClusterInfo *cluster);
2828
static void check_for_aclitem_data_type_usage(ClusterInfo *cluster);
2929
static void check_for_jsonb_9_4_usage(ClusterInfo *cluster);
3030
static void check_for_pg_role_prefix(ClusterInfo *cluster);
31-
static void check_for_new_tablespace_dir(ClusterInfo *new_cluster);
31+
static void check_for_new_tablespace_dir(void);
3232
static void check_for_user_defined_encoding_conversions(ClusterInfo *cluster);
3333

3434

@@ -209,7 +209,7 @@ check_new_cluster(void)
209209

210210
check_for_prepared_transactions(&new_cluster);
211211

212-
check_for_new_tablespace_dir(&new_cluster);
212+
check_for_new_tablespace_dir();
213213
}
214214

215215

@@ -377,7 +377,7 @@ check_new_cluster_is_empty(void)
377377
* during schema restore.
378378
*/
379379
static void
380-
check_for_new_tablespace_dir(ClusterInfo *new_cluster)
380+
check_for_new_tablespace_dir(void)
381381
{
382382
int tblnum;
383383
char new_tablespace_dir[MAXPGPATH];
@@ -390,7 +390,7 @@ check_for_new_tablespace_dir(ClusterInfo *new_cluster)
390390

391391
snprintf(new_tablespace_dir, MAXPGPATH, "%s%s",
392392
os_info.old_tablespaces[tblnum],
393-
new_cluster->tablespace_suffix);
393+
new_cluster.tablespace_suffix);
394394

395395
if (stat(new_tablespace_dir, &statbuf) == 0 || errno != ENOENT)
396396
pg_fatal("new cluster tablespace directory already exists: \"%s\"",

0 commit comments

Comments
 (0)