Skip to content

Commit 497e65f

Browse files
committed
In pg_upgrade, no need to initialize global struct values; they are
always zeros. Also no need to free memory before we exit.
1 parent bca8b7f commit 497e65f

File tree

3 files changed

+1
-32
lines changed

3 files changed

+1
-32
lines changed

contrib/pg_upgrade/info.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ static void free_rel_infos(RelInfoArr *rel_arr);
2222
static void print_db_infos(DbInfoArr *dbinfo);
2323
static void print_rel_infos(RelInfoArr *arr);
2424

25-
void
26-
initialize_cluster_info(ClusterInfo *cluster)
27-
{
28-
cluster->dbarr.ndbs = 0;
29-
cluster->dbarr.dbs = NULL;
30-
}
3125

3226
/*
3327
* gen_db_file_maps()

contrib/pg_upgrade/pg_upgrade.c

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ main(int argc, char **argv)
6363
char *deletion_script_file_name = NULL;
6464
bool live_check = false;
6565

66-
initialize_cluster_info(&old_cluster);
67-
initialize_cluster_info(&new_cluster);
68-
6966
parseCommandLine(argc, argv);
7067

7168
output_check_banner(&live_check);
@@ -428,31 +425,10 @@ set_frozenxids(void)
428425
static void
429426
cleanup(void)
430427
{
431-
int tblnum;
432428
char filename[MAXPGPATH];
433429

434-
for (tblnum = 0; tblnum < os_info.num_tablespaces; tblnum++)
435-
pg_free(os_info.tablespaces[tblnum]);
436-
pg_free(os_info.tablespaces);
437-
438-
free_db_and_rel_infos(&old_cluster.dbarr);
439-
free_db_and_rel_infos(&new_cluster.dbarr);
440-
pg_free(log_opts.filename);
441-
pg_free(os_info.user);
442-
pg_free(old_cluster.controldata.lc_collate);
443-
pg_free(new_cluster.controldata.lc_collate);
444-
pg_free(old_cluster.controldata.lc_ctype);
445-
pg_free(new_cluster.controldata.lc_ctype);
446-
pg_free(old_cluster.controldata.encoding);
447-
pg_free(new_cluster.controldata.encoding);
448-
pg_free(old_cluster.tablespace_suffix);
449-
pg_free(new_cluster.tablespace_suffix);
450-
451-
if (log_opts.fd != NULL)
452-
{
430+
if (log_opts.fd)
453431
fclose(log_opts.fd);
454-
log_opts.fd = NULL;
455-
}
456432

457433
if (log_opts.debug_fd)
458434
fclose(log_opts.debug_fd);

contrib/pg_upgrade/pg_upgrade.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ void check_loadable_libraries(void);
326326

327327
/* info.c */
328328

329-
void initialize_cluster_info(ClusterInfo *cluster);
330329
FileNameMap *gen_db_file_maps(DbInfo *old_db,
331330
DbInfo *new_db, int *nmaps, const char *old_pgdata,
332331
const char *new_pgdata);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy