]> granicus.if.org Git - postgresql/commitdiff
Cleanup ClusterInfo initialization in pg_upgrade
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 16 Feb 2011 17:06:17 +0000 (14:06 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 16 Feb 2011 17:06:17 +0000 (14:06 -0300)
contrib/pg_upgrade/info.c
contrib/pg_upgrade/pg_upgrade.c
contrib/pg_upgrade/pg_upgrade.h

index 0c518a2d1b4b69104f27e2a3bba1333c681c5e03..7a5a0501f7f39e63da54f26a561e1e004dba8b09 100644 (file)
@@ -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()
index abde25915dce174a81919c6d65e80b3ec352991d..319ee791e1e3459c15ec86353bb4b0233c2c07b0 100644 (file)
@@ -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);
 
index 446195273c1cf307e331c3822a421af8c3e62447..598625bcd1ab20fbb886935464f3e4ae4487eba4 100644 (file)
@@ -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);