*** pgsql/src/backend/utils/Gen_fmgrtab.pl 2010/01/05 01:06:56 1.4 --- pgsql/src/backend/utils/Gen_fmgrtab.pl 2010/01/05 20:23:32 1.5 *************** *** 9,15 **** # # # IDENTIFICATION ! # $PostgreSQL: pgsql/src/backend/utils/Gen_fmgrtab.pl,v 1.3 2010/01/02 16:57:53 momjian Exp $ # #------------------------------------------------------------------------- --- 9,15 ---- # # # IDENTIFICATION ! # $PostgreSQL: pgsql/src/backend/utils/Gen_fmgrtab.pl,v 1.4 2010/01/05 01:06:56 tgl Exp $ # #------------------------------------------------------------------------- *************** foreach my $column ( @{ $catalogs->{pg_p *** 58,64 **** my $data = $catalogs->{pg_proc}->{data}; foreach my $row (@$data) { - # To construct fmgroids.h and fmgrtab.c, we need to inspect some # of the individual data fields. Just splitting on whitespace # won't work, because some quoted fields might contain internal --- 58,63 ---- *************** foreach my $row (@$data) *** 81,90 **** nargs => $row->{pronargs}, prosrc => $row->{prosrc}, }; } # Emit headers for both files ! open H, '>', $output_path . 'fmgroids.h.tmp' || die "Could not open fmgroids.h.tmp: $!"; print H qq|/*------------------------------------------------------------------------- * --- 80,98 ---- nargs => $row->{pronargs}, prosrc => $row->{prosrc}, }; + + # Hack to work around memory leak in some versions of Perl + $row = undef; } # Emit headers for both files ! my $tmpext = ".tmp$$"; ! my $oidsfile = $output_path . 'fmgroids.h'; ! my $tabfile = $output_path . 'fmgrtab.c'; ! ! open H, '>', $oidsfile . $tmpext or die "Could not open $oidsfile$tmpext: $!"; ! open T, '>', $tabfile . $tmpext or die "Could not open $tabfile$tmpext: $!"; ! print H qq|/*------------------------------------------------------------------------- * *************** qq|/*----------------------------------- *** 123,129 **** */ |; - open T, '>', $output_path . 'fmgrtab.c.tmp' || die "Could not open fmgrtab.c.tmp: $!"; print T qq|/*------------------------------------------------------------------------- * --- 131,136 ---- *************** foreach my $s (sort {$a->{oid} <=> $b->{ *** 174,180 **** # And add the file footers. print H "\n#endif /* FMGROIDS_H */\n"; - close(H); print T qq| /* dummy entry is easier than getting rid of comma after last real one */ --- 181,186 ---- *************** qq| /* dummy entry is easier than getti *** 187,197 **** const int fmgr_nbuiltins = (sizeof(fmgr_builtins) / sizeof(FmgrBuiltin)) - 1; |; close(T); # Finally, rename the completed files into place. ! Catalog::RenameTempFile($output_path . 'fmgroids.h'); ! Catalog::RenameTempFile($output_path . 'fmgrtab.c'); sub usage { --- 193,204 ---- const int fmgr_nbuiltins = (sizeof(fmgr_builtins) / sizeof(FmgrBuiltin)) - 1; |; + close(H); close(T); # Finally, rename the completed files into place. ! Catalog::RenameTempFile($oidsfile, $tmpext); ! Catalog::RenameTempFile($tabfile, $tmpext); sub usage {