Commit 310ada8e authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Use dmemory.h.

parent f4c57957
......@@ -223,9 +223,9 @@ void *Ensstat3(void *argument)
if ( operfunc == func_roc ) {
ctg_tab = (int**) Malloc((nbins+1)*sizeof(int*));
hist = (int*) malloc ( nbins*sizeof(int));
uThresh = (double*) Malloc( nbins*sizeof(double));
lThresh = (double*) Malloc( nbins*sizeof(double));
hist = (int*) Malloc(nbins*sizeof(int));
uThresh = (double*) Malloc(nbins*sizeof(double));
lThresh = (double*) Malloc(nbins*sizeof(double));
roc = (double**) Malloc((nbins+1)*sizeof(double*));
for ( i=0; i<nbins; i++ ) {
......
......@@ -394,7 +394,7 @@ void *Expr(void *argument)
{
int gridID = parse_arg.coords[i].cdiID;
size_t ngp = parse_arg.coords[i].size;
double *data = (double*) malloc(ngp*sizeof(double));
double *data = (double*) Malloc(ngp*sizeof(double));
parse_arg.coords[i].data = data;
if ( coord == 'x' || coord == 'y' )
{
......@@ -429,7 +429,7 @@ void *Expr(void *argument)
{
int zaxisID = parse_arg.coords[i].cdiID;
size_t nlev = parse_arg.coords[i].size;
double *data = (double*) malloc(nlev*sizeof(double));
double *data = (double*) Malloc(nlev*sizeof(double));
parse_arg.coords[i].data = data;
zaxisInqLevels(zaxisID, data);
}
......
......@@ -999,8 +999,8 @@ int ReadColourTable( char *filepath )
cdoWarning( " Discarding improper format colours and continuing!\n" );
}
for ( i = 0; i < num_colors; i++ ) free(temp_table[i]);
free(temp_table);
for ( i = 0; i < num_colors; i++ ) Free(temp_table[i]);
Free(temp_table);
return 0;
}
......
......@@ -312,7 +312,7 @@ void *Remapeta(void *argument)
if ( nmiss )
{
missval = vlistInqVarMissval(vlistID1, varID);
imiss = (int*) malloc (nfis2gp*sizeof(int));
imiss = (int*) Malloc(nfis2gp*sizeof(int));
for ( i = 0; i < nfis2gp; ++i )
{
if ( DBL_IS_EQUAL(fis2[i], missval) )
......
......@@ -108,8 +108,8 @@ void *Timedt(void *argument)
tsID2++;
}
free(array1);
free(array2);
Free(array1);
Free(array2);
field_free(vars, vlistID1);
streamClose(streamID2);
......
......@@ -226,7 +226,7 @@ void *Timstat(void *argument)
streamDefVlist(streamID3, vlistID3);
}
recinfo_t *recinfo = (recinfo_t *) malloc(maxrecs*sizeof(recinfo_t));
recinfo_t *recinfo = (recinfo_t *) Malloc(maxrecs*sizeof(recinfo_t));
dtlist_type *dtlist = dtlist_new();
dtlist_set_stat(dtlist, timestat_date);
......
......@@ -368,7 +368,7 @@ void verify_grid(int gridsize, int gridno, int ngrids, int ncorner, double *grid
/* For performing the first test, an array of all center point coordinates is built. */
double * center_point_array = (double *)malloc(gridsize * 2 * sizeof(double));
double * center_point_array = (double *)Malloc(gridsize * 2 * sizeof(double));
for(cell_no = 0; cell_no < gridsize; cell_no++){
center_point_array[cell_no * 2 + 0] = grid_center_lon[cell_no];
......@@ -413,7 +413,7 @@ void verify_grid(int gridsize, int gridno, int ngrids, int ncorner, double *grid
}
}
free(center_point_array);
Free(center_point_array);
/*
Latitude and longitude are spherical coordinates on a unit circle. Each such coordinate tuple is transformed into a triple of Cartesian coordinates in Euclidean space.
......@@ -710,7 +710,7 @@ void *Verifygrid(void *argument)
{
int *grid_mask = (int*) Malloc(gridsize*sizeof(int));
gridInqMaskGME(gridID, grid_mask);
free(grid_mask);
Free(grid_mask);
}
*/
int ncorner = 4;
......
......@@ -323,7 +323,7 @@ void *XTimstat(void *argument)
int otsID = 0;
int nrecs = streamInqTimestep(streamID1, tsID);
int maxrecs = nrecs;
recinfo_t *recinfo = (recinfo_t *) malloc(maxrecs*sizeof(recinfo_t));
recinfo_t *recinfo = (recinfo_t *) Malloc(maxrecs*sizeof(recinfo_t));
tsID++;
while ( TRUE )
......@@ -386,7 +386,7 @@ void *XTimstat(void *argument)
if ( nmiss > 0 || samp1[varID][levelID].ptr )
{
if ( samp1[varID][levelID].ptr == NULL )
samp1[varID][levelID].ptr = (double*) malloc(nwpv*gridsize*sizeof(double));
samp1[varID][levelID].ptr = (double*) Malloc(nwpv*gridsize*sizeof(double));
for ( int i = 0; i < nwpv*gridsize; i++ )
if ( DBL_IS_EQUAL(pvar1->ptr[i], pvar1->missval) )
......@@ -417,7 +417,7 @@ void *XTimstat(void *argument)
{
if ( samp1[varID][levelID].ptr == NULL )
{
samp1[varID][levelID].ptr = (double*) malloc(nwpv*gridsize*sizeof(double));
samp1[varID][levelID].ptr = (double*) Malloc(nwpv*gridsize*sizeof(double));
for ( int i = 0; i < nwpv*gridsize; i++ )
samp1[varID][levelID].ptr[i] = nsets;
}
......
......@@ -524,5 +524,5 @@ void vlist_change_hybrid_zaxis(int vlistID1, int vlistID2, int zaxisID1, int zax
}
}
if ( vct ) free(vct);
if ( vct ) Free(vct);
}
......@@ -954,7 +954,7 @@ nodeType *fun1c(int init, int funcID, nodeType *p1, double value, parse_param_t
{
parse_arg->coords[coordID].needed = true;
data = (double*) malloc(nlev*sizeof(double));
data = (double*) Malloc(nlev*sizeof(double));
zaxisInqLevels(zaxisID, data);
}
else
......
......@@ -35,10 +35,10 @@ void search_realloc(long num_srch_cells, search_t *search)
if ( num_srch_cells > max_srch_cells )
{
partial_areas = (double*) realloc(partial_areas, num_srch_cells*sizeof(double));
partial_weights = (double*) realloc(partial_weights, num_srch_cells*sizeof(double));
overlap_buffer = (struct grid_cell*) realloc(overlap_buffer, num_srch_cells*sizeof(struct grid_cell));
src_grid_cells = (struct grid_cell*) realloc(src_grid_cells, num_srch_cells*sizeof(struct grid_cell));
partial_areas = (double*) Realloc(partial_areas, num_srch_cells*sizeof(double));
partial_weights = (double*) Realloc(partial_weights, num_srch_cells*sizeof(double));
overlap_buffer = (struct grid_cell*) Realloc(overlap_buffer, num_srch_cells*sizeof(struct grid_cell));
src_grid_cells = (struct grid_cell*) Realloc(src_grid_cells, num_srch_cells*sizeof(struct grid_cell));
for ( long n = max_srch_cells; n < num_srch_cells; ++n )
{
......@@ -55,9 +55,9 @@ void search_realloc(long num_srch_cells, search_t *search)
src_grid_cells[n].array_size = search->srch_corners;
src_grid_cells[n].num_corners = search->srch_corners;
src_grid_cells[n].edge_type = search->src_edge_type;
src_grid_cells[n].coordinates_x = (double*) malloc(search->srch_corners*sizeof(double));
src_grid_cells[n].coordinates_y = (double*) malloc(search->srch_corners*sizeof(double));
src_grid_cells[n].coordinates_xyz = (double*) malloc(3*search->srch_corners*sizeof(double));
src_grid_cells[n].coordinates_x = (double*) Malloc(search->srch_corners*sizeof(double));
src_grid_cells[n].coordinates_y = (double*) Malloc(search->srch_corners*sizeof(double));
src_grid_cells[n].coordinates_xyz = (double*) Malloc(3*search->srch_corners*sizeof(double));
}
max_srch_cells = num_srch_cells;
......
......@@ -1419,8 +1419,8 @@ void scrip_remap_conserv_weights(remapgrid_t *src_grid, remapgrid_t *tgt_grid, r
if ( num_srch_cells > max_srch_cells )
{
srch_corner_lat = (double*) realloc(srch_corner_lat, srch_corners*num_srch_cells*sizeof(double));
srch_corner_lon = (double*) realloc(srch_corner_lon, srch_corners*num_srch_cells*sizeof(double));
srch_corner_lat = (double*) Realloc(srch_corner_lat, srch_corners*num_srch_cells*sizeof(double));
srch_corner_lon = (double*) Realloc(srch_corner_lon, srch_corners*num_srch_cells*sizeof(double));
max_srch_cells = num_srch_cells;
......@@ -1642,8 +1642,8 @@ void scrip_remap_conserv_weights(remapgrid_t *src_grid, remapgrid_t *tgt_grid, r
if ( num_srch_cells > max_srch_cells )
{
srch_corner_lat = (double*) realloc(srch_corner_lat, srch_corners*num_srch_cells*sizeof(double));
srch_corner_lon = (double*) realloc(srch_corner_lon, srch_corners*num_srch_cells*sizeof(double));
srch_corner_lat = (double*) Realloc(srch_corner_lat, srch_corners*num_srch_cells*sizeof(double));
srch_corner_lon = (double*) Realloc(srch_corner_lon, srch_corners*num_srch_cells*sizeof(double));
max_srch_cells = num_srch_cells;
......
......@@ -167,7 +167,7 @@ void grid_search_nbr_reg2d(struct gridsearch *gs, int num_neighbors, remapgrid_t
for ( k = 3; k < 10000; k+=2 )
if ( num_neighbors <= ((k-2)*(k-2)) ) break;
if ( (k*k) > MAX_SEARCH_CELLS ) psrc_add = src_add_tmp = (int *) malloc(k*k*sizeof(int));
if ( (k*k) > MAX_SEARCH_CELLS ) psrc_add = src_add_tmp = (int *) Malloc(k*k*sizeof(int));
k /= 2;
......@@ -231,7 +231,7 @@ void grid_search_nbr_reg2d(struct gridsearch *gs, int num_neighbors, remapgrid_t
nbr_check_distance(num_neighbors, nbr_add, nbr_dist);
if ( src_add_tmp ) free(src_add_tmp);
if ( src_add_tmp ) Free(src_add_tmp);
}
else if ( src_grid->lextrapolate )
{
......
Supports Markdown
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