MISR Toolkit  1.5.1
MtkCoreMetaDataFree.c
Go to the documentation of this file.
1 /*===========================================================================
2 = =
3 = MtkCoreMetaDataFree =
4 = =
5 =============================================================================
6 
7  Jet Propulsion Laboratory
8  MISR
9  MISR Toolkit
10 
11  Copyright 2006, California Institute of Technology.
12  ALL RIGHTS RESERVED.
13  U.S. Government Sponsorship acknowledged.
14 
15 ============================================================================*/
16 
17 #include "MisrFileQuery.h"
18 #include "MisrError.h"
19 #include <stdlib.h>
20 
34  MtkCoreMetaData *metadata )
35 {
36  int i;
37 
38  if (metadata == NULL || metadata->data.s == NULL)
39  return MTK_SUCCESS;
40 
41  switch (metadata->datatype)
42  {
43  case MTKMETA_CHAR :
44  for (i = 0; i < metadata->num_values; ++i)
45  free(metadata->data.s[i]);
46  free(metadata->data.s);
47  break;
48  case MTKMETA_INT : free(metadata->data.i);
49  break;
50 
51  case MTKMETA_DOUBLE : free(metadata->data.d);
52  break;
53  }
54 
55  metadata->data.s = NULL;
56  metadata->dataptr = NULL;
57  metadata->num_values = 0;
58 
59  return MTK_SUCCESS;
60 }
union MtkCoreMetaData::@0 data
MTKt_status MtkCoreMetaDataFree(MtkCoreMetaData *metadata)
Free core metadata.
Core Metadata.
Definition: MisrFileQuery.h:57
enum MtkCoreMetaData::@1 datatype
MTKt_status
Definition: MisrError.h:11

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:51