From b4a7e5980b2919d4d2a849d046a8e3a77e06fdb7 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Wed, 16 Feb 2011 14:06:17 -0300 Subject: [PATCH] Cleanup ClusterInfo initialization in pg_upgrade --- contrib/pg_upgrade/info.c | 6 ++++++ contrib/pg_upgrade/pg_upgrade.c | 5 +++-- contrib/pg_upgrade/pg_upgrade.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/contrib/pg_upgrade/info.c b/contrib/pg_upgrade/info.c index 0c518a2d1b..7a5a0501f7 100644 --- a/contrib/pg_upgrade/info.c +++ b/contrib/pg_upgrade/info.c @@ -22,6 +22,12 @@ static void free_rel_infos(RelInfoArr *rel_arr); static void print_db_infos(DbInfoArr *dbinfo); static void print_rel_infos(RelInfoArr *arr); +void +initialize_cluster_info(ClusterInfo *cluster) +{ + cluster->dbarr.ndbs = 0; + cluster->dbarr.dbs = NULL; +} /* * gen_db_file_maps() diff --git a/contrib/pg_upgrade/pg_upgrade.c b/contrib/pg_upgrade/pg_upgrade.c index abde25915d..319ee791e1 100644 --- a/contrib/pg_upgrade/pg_upgrade.c +++ b/contrib/pg_upgrade/pg_upgrade.c @@ -63,9 +63,10 @@ main(int argc, char **argv) char *deletion_script_file_name = NULL; bool live_check = false; + initialize_cluster_info(&old_cluster); + initialize_cluster_info(&new_cluster); + parseCommandLine(argc, argv); - old_cluster.dbarr.ndbs = 0; - new_cluster.dbarr.ndbs = 0; output_check_banner(&live_check); diff --git a/contrib/pg_upgrade/pg_upgrade.h b/contrib/pg_upgrade/pg_upgrade.h index 446195273c..598625bcd1 100644 --- a/contrib/pg_upgrade/pg_upgrade.h +++ b/contrib/pg_upgrade/pg_upgrade.h @@ -326,6 +326,7 @@ void check_loadable_libraries(void); /* info.c */ +void initialize_cluster_info(ClusterInfo *cluster); FileNameMap *gen_db_file_maps(DbInfo *old_db, DbInfo *new_db, int *nmaps, const char *old_pgdata, const char *new_pgdata); -- 2.40.0