Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit497e65f

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 parentbca8b7f commit497e65f

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
staticvoidprint_db_infos(DbInfoArr*dbinfo);
2323
staticvoidprint_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
boollive_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
staticvoid
429426
cleanup(void)
430427
{
431-
inttblnum;
432428
charfilename[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 @@ voidcheck_loadable_libraries(void);
326326

327327
/* info.c */
328328

329-
voidinitialize_cluster_info(ClusterInfo*cluster);
330329
FileNameMap*gen_db_file_maps(DbInfo*old_db,
331330
DbInfo*new_db,int*nmaps,constchar*old_pgdata,
332331
constchar*new_pgdata);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp