Commit f3e802d1 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Added cdi_atts_t atts to grid_t.

parent 607a0ae0
......@@ -171,6 +171,8 @@ void grid_init(grid_t *gridptr)
gridptr->name = NULL;
gridptr->vtable = &cdiGridVtable;
gridptr->extraData = NULL;
gridptr->atts.nalloc = 0;
gridptr->atts.nelems = 0;
}
......@@ -178,12 +180,13 @@ static void
grid_free_components(grid_t *gridptr)
{
void *p2free[] = { gridptr->mask, gridptr->mask_gme,
gridptr->x.vals, gridptr->y.vals,
gridptr->x.bounds, gridptr->y.bounds,
gridptr->rowlon, gridptr->area,
gridptr->reference, gridptr->name };
for (size_t i = 0; i < sizeof (p2free) / sizeof (p2free[0]); ++i)
if (p2free[i]) Free(p2free[i]);
gridptr->x.vals, gridptr->y.vals,
gridptr->x.bounds, gridptr->y.bounds,
gridptr->rowlon, gridptr->area,
gridptr->reference, gridptr->name};
for (size_t i = 0; i < sizeof(p2free)/sizeof(p2free[0]); ++i)
if ( p2free[i] ) Free(p2free[i]);
}
void grid_free(grid_t *gridptr)
......@@ -197,6 +200,7 @@ gridNewEntry(cdiResH resH)
{
grid_t *gridptr = (grid_t*) Malloc(sizeof(grid_t));
grid_init(gridptr);
if (resH == CDI_UNDEFID)
gridptr->self = reshPut(gridptr, &gridOps);
else
......@@ -204,6 +208,7 @@ gridNewEntry(cdiResH resH)
gridptr->self = resH;
reshReplace(resH, gridptr, &gridOps);
}
return gridptr;
}
......@@ -555,11 +560,9 @@ int gridCreate(int gridtype, int size)
static
void gridDestroyKernel( grid_t * gridptr )
{
int id;
xassert ( gridptr );
id = gridptr->self;
int id = gridptr->self;
grid_free_components(gridptr);
Free( gridptr );
......
......@@ -4,6 +4,8 @@
#include "cdi.h"
#include <stdbool.h>
#include "vlist_att.h"
typedef unsigned char mask_t;
typedef struct grid_t grid_t;
......@@ -128,7 +130,8 @@ struct grid_t {
struct gridaxis_t x;
struct gridaxis_t y;
const struct gridVirtTable *vtable;
void *extraData;
void *extraData;
cdi_atts_t atts;
};
......
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