Commit 8ae3f448 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Added function cdiDelKeys().

parent 52c5ad8e
......@@ -111,6 +111,30 @@ int vlist_key_compare(vlist_t *a, int varIDA, vlist_t *b, int varIDB, int keynum
}
int cdiDelKeys(int cdiID, int varID)
{
int status = CDI_NOERR;
cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID);
xassert(keysp != NULL);
for ( int keyid = 0; keyid < (int)keysp->nelems; keyid++ )
{
cdi_key_t *keyp = &(keysp->value[keyid]);
if ( keyp->length && keyp->v.s )
{
free(keyp->v.s);
keyp->v.s = NULL;
keyp->length = 0;
}
}
keysp->nelems = 0;
return status;
}
int cdiCopyKeys(int cdiID1, int varID1, int cdiID2, int varID2)
{
int status = CDI_NOERR;
......
......@@ -218,6 +218,7 @@ void vlist_delete(vlist_t *vlistptr)
int vlistID = vlistptr->self;
if ( CDI_Debug ) Message("call to vlist_delete, vlistID = %d", vlistID);
cdiDelKeys(vlistID, CDI_GLOBAL);
cdiDelAtts(vlistID, CDI_GLOBAL);
int nvars = vlistptr->nvars;
......@@ -244,6 +245,7 @@ void vlist_delete(vlist_t *vlistptr)
vlistptr->vars[varID].opt_grib_kvpair_size = 0;
vlistptr->vars[varID].opt_grib_kvpair = NULL;
cdiDelKeys(vlistID, varID);
cdiDelAtts(vlistID, varID);
}
......
......@@ -132,6 +132,7 @@ void cdiVlistDestroy_(int vlistID);
int vlistInqVarMissvalUsed(int vlistID, int varID);
int vlistHasTime(int vlistID);
int cdiDelKeys(int vlistID, int varID);
int cdiDelAtts(int vlistID, int varID);
void vlistUnpack(char * buffer, int bufferSize, int * pos,
......
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