Refactored EN_close function to use newly added closeoutfile function
This commit is contained in:
20
src/epanet.c
20
src/epanet.c
@@ -332,24 +332,12 @@ int DLLEXPORT EN_close(EN_Project p)
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
Outfile *out;
|
||||
|
||||
// Free all project data
|
||||
if (p->Openflag) writetime(p, FMT105);
|
||||
freedata(p);
|
||||
|
||||
// Close output file
|
||||
out = &p->outfile;
|
||||
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;
|
||||
}
|
||||
closeoutfile(p);
|
||||
|
||||
// Close input file
|
||||
if (p->parser.InFile != NULL)
|
||||
@@ -366,10 +354,10 @@ int DLLEXPORT EN_close(EN_Project p)
|
||||
}
|
||||
|
||||
// Close hydraulics file
|
||||
if (out->HydFile != NULL)
|
||||
if (p->outfile.HydFile != NULL)
|
||||
{
|
||||
fclose(out->HydFile);
|
||||
out->HydFile = NULL;
|
||||
fclose(p->outfile.HydFile);
|
||||
p->outfile.HydFile = NULL;
|
||||
}
|
||||
|
||||
// Reset system flags
|
||||
|
||||
@@ -27,14 +27,7 @@ Last Updated: 11/27/2018
|
||||
// Stagnant flow tolerance
|
||||
const double Q_STAGNANT = 0.005 / GPMperCFS; // 0.005 gpm = 1.114e-5 cfs
|
||||
|
||||
// Exported functions (declared in FUNCS.H)
|
||||
//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);
|
||||
// Exported functions
|
||||
double findsourcequal(Project *, int, double, long);
|
||||
|
||||
// Imported functions
|
||||
|
||||
Reference in New Issue
Block a user