Skip to content
Snippets Groups Projects
Commit 3bdd7e82 authored by Thomas Jahns's avatar Thomas Jahns :cartwheel:
Browse files

Use no-fail wrappers in NetCDF test program.

parent 5fd79936
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,8 @@
#include "cdi.h"
#include "dmemory.h"
struct cart_coord {
double lat, lon;
};
......@@ -63,16 +65,11 @@ int main(int argc, const char **argv)
#endif
double (*gridCoords)[sizey][sizex]
= (double (*)[sizey][sizex])
malloc(sizeof (*gridCoords) * sizey * sizex * 2);
if (gridCoords == NULL)
{
perror("grid coordinate memory allocation failed");
return EXIT_FAILURE;
}
Malloc(sizeof (*gridCoords) * sizey * sizex * 2);
compute_curvilinear((double *)gridCoords, region, sizex, sizey);
gridDefXvals(gridID, (double *)(gridCoords[1]));
gridDefYvals(gridID, (double *)(gridCoords[0]));
free(gridCoords);
Free(gridCoords);
}
int zaxisID = zaxisCreate(ZAXIS_SURFACE, 1);
......@@ -94,12 +91,7 @@ int main(int argc, const char **argv)
(void)streamDefTimestep(streamID, 0);
{
double (*data)[sizex] = (double(*)[sizex])malloc(sizeof (**data) * sizex * sizey);
if (!data)
{
perror("data values memory allocation failed");
return EXIT_FAILURE;
}
double (*data)[sizex] = (double(*)[sizex])Malloc(sizeof (**data) * sizex * sizey);
for (size_t j = 0; j < sizey; ++j)
for (size_t i = 0; i < sizex; ++i)
{
......@@ -107,7 +99,7 @@ int main(int argc, const char **argv)
}
data[sizey/3][sizex/2] = missValue;
streamWriteVar(streamID, 0, (const double *)data, 1);
free(data);
Free(data);
}
streamClose(streamID);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment