Commit 0a27d68d authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Replaced Malloc() by std::vector.

parent 024ab16b
......@@ -416,11 +416,11 @@ void *Intlevel(void *argument)
int streamID2 = pstreamOpenWrite(cdoStreamName(1), cdoFiletype());
pstreamDefVlist(streamID2, vlistID2);
bool *vars = (bool*) Malloc(nvars*sizeof(bool));
bool *varinterp = (bool*) Malloc(nvars*sizeof(bool));
size_t **varnmiss = (size_t**) Malloc(nvars*sizeof(size_t*));
double **vardata1 = (double**) Malloc(nvars*sizeof(double*));
double **vardata2 = (double**) Malloc(nvars*sizeof(double*));
std::vector<bool> vars(nvars);
std::vector<bool> varinterp(nvars);
std::vector<size_t *> varnmiss(nvars);
std::vector<double *> vardata1(nvars);
std::vector<double *> vardata2(nvars);
int maxlev = nlev1 > nlev2 ? nlev1 : nlev2;
......@@ -542,12 +542,6 @@ void *Intlevel(void *argument)
if ( varinterp[varID] ) Free(vardata2[varID]);
}
Free(varinterp);
Free(varnmiss);
Free(vardata2);
Free(vardata1);
Free(vars);
Free(lev_idx1);
Free(lev_idx2);
Free(lev_wgt1);
......
......@@ -279,11 +279,12 @@ void *Intlevel3d(void *argument)
maxlev = nlevi > nlevo ? nlevi : nlevo;
nvars = vlistNvars(vlistID1);
bool *vars = (bool*) Malloc(nvars*sizeof(bool));
bool *varinterp = (bool*) Malloc(nvars*sizeof(bool)); /* marker for variables to be interpolated */
size_t **varnmiss = (size_t**) Malloc(nvars*sizeof(size_t*)); /* can for missing values of arbitrary variables */
double **vardata1 = (double**) Malloc(nvars*sizeof(double*)); /* input */
double **vardata2 = (double**) Malloc(nvars*sizeof(double*)); /* output */
std::vector<bool> vars(nvars);
std::vector<bool> varinterp(nvars); /* marker for variables to be interpolated */
std::vector<size_t *> varnmiss(nvars); /* can for missing values of arbitrary variables */
std::vector<double *> vardata1(nvars); /* input */
std::vector<double *> vardata2(nvars); /* output */
/* by default no variable should be interpolated */
for ( i = 0; i < nvars; i++ ) varinterp[varID] = false;
......@@ -425,13 +426,6 @@ void *Intlevel3d(void *argument)
if ( varinterp[varID] ) Free(vardata2[varID]);
}
Free(varinterp);
Free(varnmiss);
Free(vardata2);
Free(vardata1);
Free(vars);
Free(lev_idx1);
Free(lev_idx2);
Free(lev_wgt1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment