Refactored EN_close function to use newly added closeoutfile function

This commit is contained in:
Lew Rossman
2019-03-06 13:23:55 -05:00
parent 6e13d7e3aa
commit 12c64b69cd
2 changed files with 5 additions and 24 deletions

View File

@@ -332,24 +332,12 @@ int DLLEXPORT EN_close(EN_Project p)
**---------------------------------------------------------------- **----------------------------------------------------------------
*/ */
{ {
Outfile *out;
// Free all project data // Free all project data
if (p->Openflag) writetime(p, FMT105); if (p->Openflag) writetime(p, FMT105);
freedata(p); freedata(p);
// Close output file // Close output file
out = &p->outfile; closeoutfile(p);
if (out->TmpOutFile != out->OutFile)
{
if (out->TmpOutFile != NULL) fclose(out->TmpOutFile);
out->TmpOutFile = NULL;
}
if (out->OutFile != NULL)
{
fclose(out->OutFile);
out->OutFile = NULL;
}
// Close input file // Close input file
if (p->parser.InFile != NULL) if (p->parser.InFile != NULL)
@@ -366,10 +354,10 @@ int DLLEXPORT EN_close(EN_Project p)
} }
// Close hydraulics file // Close hydraulics file
if (out->HydFile != NULL) if (p->outfile.HydFile != NULL)
{ {
fclose(out->HydFile); fclose(p->outfile.HydFile);
out->HydFile = NULL; p->outfile.HydFile = NULL;
} }
// Reset system flags // Reset system flags

View File

@@ -27,14 +27,7 @@ Last Updated: 11/27/2018
// Stagnant flow tolerance // Stagnant flow tolerance
const double Q_STAGNANT = 0.005 / GPMperCFS; // 0.005 gpm = 1.114e-5 cfs const double Q_STAGNANT = 0.005 / GPMperCFS; // 0.005 gpm = 1.114e-5 cfs
// Exported functions (declared in FUNCS.H) // Exported functions
//int openqual(Project *);
//void initqual(Project *);
//int runqual(Project *, long *);
//int nextqual(Project *, long *);
//int stepqual(Project *, long *);
//int closequal(Project *);
//double avgqual(Project *, int);
double findsourcequal(Project *, int, double, long); double findsourcequal(Project *, int, double, long);
// Imported functions // Imported functions