Use xvgrclose() for files opened with xvgropen()
authorTeemu Murtola <teemu.murtola@gmail.com>
Tue, 6 Jan 2015 07:59:42 +0000 (09:59 +0200)
committerTeemu Murtola <teemu.murtola@gmail.com>
Tue, 6 Jan 2015 07:59:42 +0000 (09:59 +0200)
commitfa60bf2620de49b0b202fea6d04a978f358312a6
tree02a06de78661b17719660352e450baee6792263d
parent07e73960a375397665f7a4fce557363fefc65ae9
Use xvgrclose() for files opened with xvgropen()

Most callers used gmx_ffclose(), but there were also several that just
didn't close the file at all, or used plain fclose().  Not using
gmx_fio_fclose() left internal data structures inconsistent, which could
have an effect in unit test binaries that could execute some code more
than once (in particular, if the checkpoint code was triggered, as it
then got confused about the improperly closed files).

For consistency, changed gmx_fio_fclose() to xvgrclose(), except in
places where there were paths on which the file was not opened with
xvgropen().  Fixed some logic issues with opening/closing files in
different branches.

Change-Id: Iefda6880b06391b73423156888aee1d436e38199
57 files changed:
src/gromacs/correlationfunctions/autocorr.c
src/gromacs/essentialdynamics/edsam.c
src/gromacs/fileio/mdoutf.c
src/gromacs/gmxana/anadih.c
src/gromacs/gmxana/cmat.c
src/gromacs/gmxana/gmx_anadock.c
src/gromacs/gmxana/gmx_anaeig.c
src/gromacs/gmxana/gmx_analyze.c
src/gromacs/gmxana/gmx_angle.c
src/gromacs/gmxana/gmx_bar.c
src/gromacs/gmxana/gmx_bundle.c
src/gromacs/gmxana/gmx_chi.c
src/gromacs/gmxana/gmx_cluster.c
src/gromacs/gmxana/gmx_clustsize.c
src/gromacs/gmxana/gmx_covar.c
src/gromacs/gmxana/gmx_current.c
src/gromacs/gmxana/gmx_density.c
src/gromacs/gmxana/gmx_dielectric.c
src/gromacs/gmxana/gmx_dipoles.cpp
src/gromacs/gmxana/gmx_disre.c
src/gromacs/gmxana/gmx_do_dssp.c
src/gromacs/gmxana/gmx_dyecoupl.c
src/gromacs/gmxana/gmx_enemat.c
src/gromacs/gmxana/gmx_energy.c
src/gromacs/gmxana/gmx_gyrate.c
src/gromacs/gmxana/gmx_h2order.c
src/gromacs/gmxana/gmx_hbond.c
src/gromacs/gmxana/gmx_helix.c
src/gromacs/gmxana/gmx_helixorient.c
src/gromacs/gmxana/gmx_lie.c
src/gromacs/gmxana/gmx_mdmat.c
src/gromacs/gmxana/gmx_mindist.c
src/gromacs/gmxana/gmx_morph.c
src/gromacs/gmxana/gmx_msd.c
src/gromacs/gmxana/gmx_nmeig.c
src/gromacs/gmxana/gmx_order.c
src/gromacs/gmxana/gmx_polystat.c
src/gromacs/gmxana/gmx_potential.c
src/gromacs/gmxana/gmx_rama.c
src/gromacs/gmxana/gmx_rms.c
src/gromacs/gmxana/gmx_rmsdist.c
src/gromacs/gmxana/gmx_rmsf.c
src/gromacs/gmxana/gmx_rotmat.c
src/gromacs/gmxana/gmx_saltbr.c
src/gromacs/gmxana/gmx_sans.c
src/gromacs/gmxana/gmx_sham.c
src/gromacs/gmxana/gmx_sigeps.c
src/gromacs/gmxana/gmx_sorient.c
src/gromacs/gmxana/gmx_spol.c
src/gromacs/gmxana/gmx_tcaf.c
src/gromacs/gmxana/gmx_traj.c
src/gromacs/gmxana/gmx_trjorder.c
src/gromacs/gmxana/gmx_vanhove.c
src/gromacs/gmxana/gmx_wham.cpp
src/gromacs/gmxana/sfactor.c
src/gromacs/mdlib/tables.c
src/gromacs/mdlib/tpi.cpp