mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-30 16:10:44 +08:00
removed archaic code to check memory use
This commit is contained in:
parent
a30e281b34
commit
0ac8ec40a1
@ -32,13 +32,6 @@ extern int nc4_vararray_add(NC_GRP_INFO_T *grp,
|
||||
*/
|
||||
#define LOGOPEN 1
|
||||
|
||||
/* This is to track opened HDF5 objects to make sure they are
|
||||
* closed. */
|
||||
#ifdef EXTRA_TESTS
|
||||
extern int num_plists;
|
||||
extern int num_spaces;
|
||||
#endif /* EXTRA_TESTS */
|
||||
|
||||
#define MIN_DEFLATE_LEVEL 0
|
||||
#define MAX_DEFLATE_LEVEL 9
|
||||
|
||||
@ -417,9 +410,6 @@ nc4_create_file(const char *path, int cmode, MPI_Comm comm, MPI_Info info,
|
||||
* fail if there are any open objects in the file. */
|
||||
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists++;
|
||||
#endif
|
||||
#ifdef EXTRA_TESTS
|
||||
if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI))
|
||||
BAIL(NC_EHDFERR);
|
||||
@ -492,9 +482,6 @@ nc4_create_file(const char *path, int cmode, MPI_Comm comm, MPI_Info info,
|
||||
/* Create the property list. */
|
||||
if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists++;
|
||||
#endif
|
||||
|
||||
/* RJ: this suppose to be FALSE that is defined in H5 private.h as 0 */
|
||||
if (H5Pset_obj_track_times(fcpl_id,0)<0)
|
||||
@ -529,10 +516,6 @@ nc4_create_file(const char *path, int cmode, MPI_Comm comm, MPI_Info info,
|
||||
/* Release the property lists. */
|
||||
if (H5Pclose(fapl_id) < 0 || H5Pclose(fcpl_id) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists--;
|
||||
num_plists--;
|
||||
#endif
|
||||
|
||||
/* Define mode gets turned on automatically on create. */
|
||||
nc4_info->flags |= NC_INDEF;
|
||||
@ -546,9 +529,6 @@ exit: /*failure exit*/
|
||||
#ifdef USE_PARALLEL4
|
||||
if (comm_duped) MPI_Comm_free(&nc4_info->comm);
|
||||
if (info_duped) MPI_Info_free(&nc4_info->info);
|
||||
#endif
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists--;
|
||||
#endif
|
||||
if (fapl_id != H5P_DEFAULT) H5Pclose(fapl_id);
|
||||
if(!nc4_info) return retval;
|
||||
@ -768,9 +748,6 @@ read_coord_dimids(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
|
||||
|
||||
/* How many dimensions are there? */
|
||||
if (!ret && (spaceid = H5Aget_space(coord_attid)) < 0) ret++;
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
if (!ret && (npoints = H5Sget_simple_extent_npoints(spaceid)) < 0) ret++;
|
||||
|
||||
/* Check that the number of points is the same as the number of dimensions
|
||||
@ -788,9 +765,6 @@ read_coord_dimids(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
|
||||
|
||||
/* Set my HDF5 IDs free! */
|
||||
if (spaceid >= 0 && H5Sclose(spaceid) < 0) ret++;
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces--;
|
||||
#endif
|
||||
if (coord_att_typeid >= 0 && H5Tclose(coord_att_typeid) < 0) ret++;
|
||||
if (coord_attid >= 0 && H5Aclose(coord_attid) < 0) ret++;
|
||||
return ret ? NC_EATTMETA : NC_NOERR;
|
||||
@ -1105,9 +1079,6 @@ read_hdf5_att(NC_GRP_INFO_T *grp, hid_t attid, NC_ATT_INFO_T *att)
|
||||
/* Get len. */
|
||||
if ((spaceid = H5Aget_space(attid)) < 0)
|
||||
BAIL(NC_EATTMETA);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
if ((att_ndims = H5Sget_simple_extent_ndims(spaceid)) < 0)
|
||||
BAIL(NC_EATTMETA);
|
||||
if ((att_npoints = H5Sget_simple_extent_npoints(spaceid)) < 0)
|
||||
@ -1246,9 +1217,6 @@ read_hdf5_att(NC_GRP_INFO_T *grp, hid_t attid, NC_ATT_INFO_T *att)
|
||||
BAIL(NC_EHDFERR);
|
||||
if (H5Sclose(spaceid) < 0)
|
||||
return NC_EHDFERR;
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces--;
|
||||
#endif
|
||||
|
||||
return NC_NOERR;
|
||||
|
||||
@ -1257,9 +1225,6 @@ read_hdf5_att(NC_GRP_INFO_T *grp, hid_t attid, NC_ATT_INFO_T *att)
|
||||
BAIL2(NC_EHDFERR);
|
||||
if (spaceid > 0 && H5Sclose(spaceid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces--;
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -1556,13 +1521,8 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name,
|
||||
NC_VAR_INFO_T *var = NULL;
|
||||
hid_t access_pid = 0;
|
||||
int incr_id_rc = 0; /* Whether the dataset ID's ref count has been incremented */
|
||||
int natts, a, d;
|
||||
const char** reserved;
|
||||
|
||||
NC_ATT_INFO_T *att;
|
||||
int d;
|
||||
att_iter_info att_info; /* Custom iteration information */
|
||||
char att_name[NC_MAX_HDF5_NAME + 1];
|
||||
|
||||
#define CD_NELEMS_ZLIB 1
|
||||
#define CD_NELEMS_SZIP 4
|
||||
H5Z_filter_t filter;
|
||||
@ -1605,9 +1565,6 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name,
|
||||
/* Get the current chunk cache settings. */
|
||||
if ((access_pid = H5Dget_access_plist(datasetid)) < 0)
|
||||
BAIL(NC_EVARMETA);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists++;
|
||||
#endif
|
||||
|
||||
/* Learn about current chunk cache settings. */
|
||||
if ((H5Pget_chunk_cache(access_pid, &(var->chunk_cache_nelems),
|
||||
@ -1648,9 +1605,6 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name,
|
||||
* ignored. */
|
||||
if ((propid = H5Dget_create_plist(datasetid)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists++;
|
||||
#endif /* EXTRA_TESTS */
|
||||
|
||||
/* Get the chunking info for non-scalar vars. */
|
||||
if ((layout = H5Pget_layout(propid)) < -1)
|
||||
@ -1832,14 +1786,8 @@ exit:
|
||||
}
|
||||
if (access_pid && H5Pclose(access_pid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists--;
|
||||
#endif
|
||||
if (propid > 0 && H5Pclose(propid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists--;
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -1936,9 +1884,6 @@ read_dataset(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name,
|
||||
/* Get the dimension information for this dataset. */
|
||||
if ((spaceid = H5Dget_space(datasetid)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
if ((ndims = H5Sget_simple_extent_ndims(spaceid)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
|
||||
@ -1970,9 +1915,6 @@ read_dataset(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name,
|
||||
exit:
|
||||
if (spaceid && H5Sclose(spaceid) <0)
|
||||
BAIL2(retval);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces--;
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
}
|
||||
@ -2252,9 +2194,6 @@ nc4_open_file(const char *path, int mode, void* parameters, NC *nc)
|
||||
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists++;
|
||||
#endif
|
||||
#ifdef EXTRA_TESTS
|
||||
if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI))
|
||||
BAIL(NC_EHDFERR);
|
||||
@ -2355,9 +2294,6 @@ nc4_open_file(const char *path, int mode, void* parameters, NC *nc)
|
||||
/* Close the property list. */
|
||||
if (H5Pclose(fapl_id) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists--;
|
||||
#endif
|
||||
|
||||
NC4_get_fileinfo(nc4_info,NULL);
|
||||
|
||||
@ -2367,9 +2303,6 @@ exit:
|
||||
#ifdef USE_PARALLEL4
|
||||
if (comm_duped) MPI_Comm_free(&nc4_info->comm);
|
||||
if (info_duped) MPI_Info_free(&nc4_info->info);
|
||||
#endif
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists--;
|
||||
#endif
|
||||
if (fapl_id != H5P_DEFAULT) H5Pclose(fapl_id);
|
||||
if (!nc4_info) return retval;
|
||||
@ -3301,17 +3234,6 @@ nc4_enddef_netcdf4_file(NC_HDF5_FILE_INFO_T *h5)
|
||||
return sync_netcdf4_file(h5);
|
||||
}
|
||||
|
||||
#ifdef EXTRA_TESTS
|
||||
int
|
||||
nc_exit()
|
||||
{
|
||||
if (num_plists || num_spaces)
|
||||
return NC_EHDFERR;
|
||||
|
||||
return NC_NOERR;
|
||||
}
|
||||
#endif /* EXTRA_TESTS */
|
||||
|
||||
#ifdef USE_PARALLEL4
|
||||
int
|
||||
nc_use_parallel_enabled()
|
||||
|
139
libsrc4/nc4hdf.c
139
libsrc4/nc4hdf.c
@ -27,13 +27,6 @@
|
||||
|
||||
#define NC_HDF5_MAX_NAME 1024
|
||||
|
||||
/* This is to track opened HDF5 objects to make sure they are
|
||||
* closed. */
|
||||
#ifdef EXTRA_TESTS
|
||||
int num_plists;
|
||||
int num_spaces;
|
||||
#endif /* EXTRA_TESTS */
|
||||
|
||||
/*! Flag attributes in a linked list as dirty.
|
||||
*
|
||||
* Given a linked list of attributes, flag each
|
||||
@ -612,9 +605,6 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
/* Get file space of data. */
|
||||
if ((file_spaceid = H5Dget_space(var->hdf_datasetid)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
|
||||
/* Check to ensure the user selection is
|
||||
* valid. H5Sget_simple_extent_dims gets the sizes of all the dims
|
||||
@ -654,9 +644,6 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
{
|
||||
if ((mem_spaceid = H5Screate(H5S_SCALAR)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -668,9 +655,6 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
we want. */
|
||||
if ((mem_spaceid = H5Screate_simple(var->ndims, count, NULL)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef HDF5_CONVERT
|
||||
@ -715,9 +699,6 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
/* Create the data transfer property list. */
|
||||
if ((xfer_plistid = H5Pcreate(H5P_DATASET_XFER)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists++;
|
||||
#endif
|
||||
|
||||
/* Apply the callback function which will detect range
|
||||
* errors. Which one to call depends on the length of the
|
||||
@ -806,9 +787,6 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
BAIL2(NC_EHDFERR);
|
||||
if ((file_spaceid = H5Dget_space(var->hdf_datasetid)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
if (H5Sselect_hyperslab(file_spaceid, H5S_SELECT_SET,
|
||||
start, NULL, count, NULL) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
@ -853,19 +831,10 @@ nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
#endif
|
||||
if (file_spaceid > 0 && H5Sclose(file_spaceid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces--;
|
||||
#endif
|
||||
if (mem_spaceid > 0 && H5Sclose(mem_spaceid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces--;
|
||||
#endif
|
||||
if (xfer_plistid && (H5Pclose(xfer_plistid) < 0))
|
||||
BAIL2(NC_EPARINIT);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists--;
|
||||
#endif
|
||||
#ifndef HDF5_CONVERT
|
||||
if (need_to_convert && bufr) free(bufr);
|
||||
#endif
|
||||
@ -944,9 +913,6 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
/* Get file space of data. */
|
||||
if ((file_spaceid = H5Dget_space(var->hdf_datasetid)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
|
||||
/* Check to ensure the user selection is
|
||||
* valid. H5Sget_simple_extent_dims gets the sizes of all the dims
|
||||
@ -1038,9 +1004,6 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
if ((mem_spaceid = H5Screate(H5S_SCALAR)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
scalar++;
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1051,9 +1014,6 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
we want. */
|
||||
if ((mem_spaceid = H5Screate_simple(var->ndims, count, NULL)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Fix bug when reading HDF5 files with variable of type
|
||||
@ -1110,9 +1070,6 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
/* Create the data transfer property list. */
|
||||
if ((xfer_plistid = H5Pcreate(H5P_DATASET_XFER)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists++;
|
||||
#endif
|
||||
|
||||
#ifdef HDF5_CONVERT
|
||||
/* Apply the callback function which will detect range
|
||||
@ -1177,9 +1134,6 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
/* Create the data transfer property list. */
|
||||
if ((xfer_plistid = H5Pcreate(H5P_DATASET_XFER)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists++;
|
||||
#endif
|
||||
|
||||
if ((retval = set_par_access(h5, var, xfer_plistid)))
|
||||
BAIL(retval);
|
||||
@ -1194,9 +1148,6 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
if (H5Sselect_none(mem_spaceid)<0)
|
||||
BAIL(NC_EHDFERR);
|
||||
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
/* Read this hyperslab into memory. */
|
||||
LOG((5, "About to H5Dread some data..."));
|
||||
if (H5Dread(var->hdf_datasetid, var->type_info->native_hdf_typeid,
|
||||
@ -1264,25 +1215,16 @@ nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
|
||||
{
|
||||
if (H5Sclose(file_spaceid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces--;
|
||||
#endif
|
||||
}
|
||||
if (mem_spaceid > 0)
|
||||
{
|
||||
if (H5Sclose(mem_spaceid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces--;
|
||||
#endif
|
||||
}
|
||||
if (xfer_plistid > 0)
|
||||
{
|
||||
if (H5Pclose(xfer_plistid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists--;
|
||||
#endif
|
||||
}
|
||||
#ifndef HDF5_CONVERT
|
||||
if (need_to_convert && bufr != NULL)
|
||||
@ -1380,17 +1322,11 @@ put_att_grpa(NC_GRP_INFO_T *grp, int varid, NC_ATT_INFO_T *att)
|
||||
string_size = 1;
|
||||
if ((spaceid = H5Screate(H5S_NULL)) < 0)
|
||||
BAIL(NC_EATTMETA);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((spaceid = H5Screate(H5S_SCALAR)) < 0)
|
||||
BAIL(NC_EATTMETA);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
}
|
||||
if (H5Tset_size(file_typeid, string_size) < 0)
|
||||
BAIL(NC_EATTMETA);
|
||||
@ -1403,17 +1339,11 @@ put_att_grpa(NC_GRP_INFO_T *grp, int varid, NC_ATT_INFO_T *att)
|
||||
{
|
||||
if ((spaceid = H5Screate(H5S_NULL)) < 0)
|
||||
BAIL(NC_EATTMETA);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((spaceid = H5Screate_simple(1, dims, NULL)) < 0)
|
||||
BAIL(NC_EATTMETA);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if ((attid = H5Acreate(locid, att->name, file_typeid, spaceid,
|
||||
@ -1431,9 +1361,6 @@ put_att_grpa(NC_GRP_INFO_T *grp, int varid, NC_ATT_INFO_T *att)
|
||||
BAIL2(NC_EHDFERR);
|
||||
if (spaceid > 0 && H5Sclose(spaceid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces--;
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -1479,18 +1406,12 @@ write_coord_dimids(NC_VAR_INFO_T *var)
|
||||
/* Write our attribute. */
|
||||
coords_len[0] = var->ndims;
|
||||
if ((c_spaceid = H5Screate_simple(1, coords_len, coords_len)) < 0) ret++;
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
if (!ret && (c_attid = H5Acreate(var->hdf_datasetid, COORDINATES, H5T_NATIVE_INT,
|
||||
c_spaceid, H5P_DEFAULT)) < 0) ret++;
|
||||
if (!ret && H5Awrite(c_attid, H5T_NATIVE_INT, var->dimids) < 0) ret++;
|
||||
|
||||
/* Close up shop. */
|
||||
if (c_spaceid > 0 && H5Sclose(c_spaceid) < 0) ret++;
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces--;
|
||||
#endif
|
||||
if (c_attid > 0 && H5Aclose(c_attid) < 0) ret++;
|
||||
return ret ? NC_EHDFERR : 0;
|
||||
}
|
||||
@ -1505,9 +1426,6 @@ write_netcdf4_dimid(hid_t datasetid, int dimid)
|
||||
/* Create the space. */
|
||||
if ((dimid_spaceid = H5Screate(H5S_SCALAR)) < 0)
|
||||
return NC_EHDFERR;
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
|
||||
/* Does the attribute already exist? If so, don't try to create it. */
|
||||
if ((attr_exists = H5Aexists(datasetid, NC_DIMID_ATT_NAME)) < 0)
|
||||
@ -1531,9 +1449,6 @@ write_netcdf4_dimid(hid_t datasetid, int dimid)
|
||||
/* Close stuff*/
|
||||
if (H5Sclose(dimid_spaceid) < 0)
|
||||
return NC_EHDFERR;
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces--;
|
||||
#endif
|
||||
if (H5Aclose(dimid_attid) < 0)
|
||||
return NC_EHDFERR;
|
||||
|
||||
@ -1557,14 +1472,8 @@ var_create_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, nc_bool_t write_dimid
|
||||
/* Scalar or not, we need a creation property list. */
|
||||
if ((plistid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists++;
|
||||
#endif
|
||||
if ((access_plistid = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists++;
|
||||
#endif
|
||||
|
||||
/* RJ: this suppose to be FALSE that is defined in H5 private.h as 0 */
|
||||
if (H5Pset_obj_track_times(plistid,0)<0)
|
||||
@ -1721,17 +1630,11 @@ var_create_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, nc_bool_t write_dimid
|
||||
/* Create the dataspace. */
|
||||
if ((spaceid = H5Screate_simple(var->ndims, dimsize, maxdimsize)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((spaceid = H5Screate(H5S_SCALAR)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Turn on creation order tracking. */
|
||||
@ -1786,19 +1689,10 @@ var_create_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, nc_bool_t write_dimid
|
||||
BAIL2(NC_EHDFERR);
|
||||
if (plistid > 0 && H5Pclose(plistid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists--;
|
||||
#endif
|
||||
if (access_plistid > 0 && H5Pclose(access_plistid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists--;
|
||||
#endif
|
||||
if (spaceid > 0 && H5Sclose(spaceid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces--;
|
||||
#endif
|
||||
if (fillp)
|
||||
{
|
||||
if (var->type_info->nc_type_class == NC_VLEN)
|
||||
@ -1991,9 +1885,6 @@ write_nc3_strict_att(hid_t hdf_grpid)
|
||||
* strict netcdf-3 rules. */
|
||||
if ((spaceid = H5Screate(H5S_SCALAR)) < 0)
|
||||
BAIL(NC_EFILEMETA);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
if ((attid = H5Acreate(hdf_grpid, NC3_STRICT_ATT_NAME,
|
||||
H5T_NATIVE_INT, spaceid, H5P_DEFAULT)) < 0)
|
||||
BAIL(NC_EFILEMETA);
|
||||
@ -2003,9 +1894,6 @@ write_nc3_strict_att(hid_t hdf_grpid)
|
||||
exit:
|
||||
if (spaceid > 0 && (H5Sclose(spaceid) < 0))
|
||||
BAIL2(NC_EFILEMETA);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces--;
|
||||
#endif
|
||||
if (attid > 0 && (H5Aclose(attid) < 0))
|
||||
BAIL2(NC_EFILEMETA);
|
||||
return retval;
|
||||
@ -2026,9 +1914,6 @@ create_group(NC_GRP_INFO_T *grp)
|
||||
* creation property list. */
|
||||
if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
|
||||
return NC_EHDFERR;
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists++;
|
||||
#endif
|
||||
|
||||
/* RJ: this suppose to be FALSE that is defined in H5 private.h as 0 */
|
||||
if (H5Pset_obj_track_times(gcpl_id,0)<0)
|
||||
@ -2043,9 +1928,6 @@ create_group(NC_GRP_INFO_T *grp)
|
||||
BAIL(NC_EHDFERR);
|
||||
if (H5Pclose(gcpl_id) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists--;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2058,9 +1940,6 @@ create_group(NC_GRP_INFO_T *grp)
|
||||
exit:
|
||||
if (gcpl_id > 0 && H5Pclose(gcpl_id) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists--;
|
||||
#endif
|
||||
if (grp->hdf_grpid > 0 && H5Gclose(grp->hdf_grpid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
return retval;
|
||||
@ -2399,9 +2278,6 @@ write_dim(NC_DIM_INFO_T *dim, NC_GRP_INFO_T *grp, nc_bool_t write_dimid)
|
||||
* up chunking, with a chunksize of 1. */
|
||||
if ((create_propid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists++;
|
||||
#endif
|
||||
|
||||
/* RJ: this suppose to be FALSE that is defined in H5 private.h as 0 */
|
||||
if (H5Pset_obj_track_times(create_propid,0)<0)
|
||||
@ -2419,9 +2295,6 @@ write_dim(NC_DIM_INFO_T *dim, NC_GRP_INFO_T *grp, nc_bool_t write_dimid)
|
||||
/* Set up space. */
|
||||
if ((spaceid = H5Screate_simple(1, dims, max_dims)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
|
||||
if (H5Pset_attr_creation_order(create_propid, H5P_CRT_ORDER_TRACKED|
|
||||
H5P_CRT_ORDER_INDEXED) < 0)
|
||||
@ -2436,14 +2309,8 @@ write_dim(NC_DIM_INFO_T *dim, NC_GRP_INFO_T *grp, nc_bool_t write_dimid)
|
||||
/* Close the spaceid and create_propid. */
|
||||
if (H5Sclose(spaceid) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces--;
|
||||
#endif
|
||||
if (H5Pclose(create_propid) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists--;
|
||||
#endif
|
||||
|
||||
/* Indicate that this is a scale. Also indicate that not
|
||||
* be shown to the user as a variable. It is hidden. It is
|
||||
@ -3739,9 +3606,6 @@ nc4_rec_match_dimscales(NC_GRP_INFO_T *grp)
|
||||
/* Find the space information for this dimension. */
|
||||
if ((spaceid = H5Dget_space(var->hdf_datasetid)) < 0)
|
||||
return NC_EHDFERR;
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
|
||||
/* Get the len of each dim in the space. */
|
||||
if (var->ndims)
|
||||
@ -3778,9 +3642,6 @@ nc4_rec_match_dimscales(NC_GRP_INFO_T *grp)
|
||||
free(h5dimlenmax);
|
||||
return NC_EHDFERR;
|
||||
}
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces--;
|
||||
#endif
|
||||
|
||||
/* Create a phony dimension for each dimension in the
|
||||
* dataset, unless there already is one the correct
|
||||
|
@ -40,12 +40,6 @@ extern size_t nc4_chunk_cache_size;
|
||||
extern size_t nc4_chunk_cache_nelems;
|
||||
extern float nc4_chunk_cache_preemption;
|
||||
|
||||
/* This is to track opened HDF5 objects to make sure they are
|
||||
* closed. */
|
||||
#ifdef EXTRA_TESTS
|
||||
extern int num_spaces;
|
||||
#endif /* EXTRA_TESTS */
|
||||
|
||||
#ifdef LOGGING
|
||||
/* This is the severity level of messages which will be logged. Use
|
||||
severity 0 for errors, 1 for important log messages, 2 for less
|
||||
@ -146,9 +140,7 @@ find_var_dim_max_length(NC_GRP_INFO_T *grp, int varid, int dimid, size_t *maxlen
|
||||
BAIL(retval);
|
||||
if ((spaceid = H5Dget_space(datasetid)) < 0)
|
||||
BAIL(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces++;
|
||||
#endif
|
||||
|
||||
/* If it's a scalar dataset, it has length one. */
|
||||
if (H5Sget_simple_extent_type(spaceid) == H5S_SCALAR)
|
||||
{
|
||||
@ -182,9 +174,6 @@ find_var_dim_max_length(NC_GRP_INFO_T *grp, int varid, int dimid, size_t *maxlen
|
||||
exit:
|
||||
if (spaceid > 0 && H5Sclose(spaceid) < 0)
|
||||
BAIL2(NC_EHDFERR);
|
||||
#ifdef EXTRA_TESTS
|
||||
num_spaces--;
|
||||
#endif
|
||||
if (h5dimlen) free(h5dimlen);
|
||||
if (h5dimlenmax) free(h5dimlenmax);
|
||||
return retval;
|
||||
|
@ -17,12 +17,6 @@ conditions.
|
||||
#define MIN_DEFLATE_LEVEL 0
|
||||
#define MAX_DEFLATE_LEVEL 9
|
||||
|
||||
/* This is to track opened HDF5 objects to make sure they are
|
||||
* closed. */
|
||||
#ifdef EXTRA_TESTS
|
||||
extern int num_plists;
|
||||
#endif /* EXTRA_TESTS */
|
||||
|
||||
/* One meg is the minimum buffer size. */
|
||||
#define ONE_MEG 1048576
|
||||
|
||||
@ -45,9 +39,6 @@ nc4_reopen_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
|
||||
{
|
||||
if ((access_pid = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
|
||||
return NC_EHDFERR;
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists++;
|
||||
#endif
|
||||
if (H5Pset_chunk_cache(access_pid, var->chunk_cache_nelems,
|
||||
var->chunk_cache_size,
|
||||
var->chunk_cache_preemption) < 0)
|
||||
@ -59,9 +50,6 @@ nc4_reopen_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
|
||||
return NC_EHDFERR;
|
||||
if (H5Pclose(access_pid) < 0)
|
||||
return NC_EHDFERR;
|
||||
#ifdef EXTRA_TESTS
|
||||
num_plists--;
|
||||
#endif
|
||||
}
|
||||
|
||||
return NC_NOERR;
|
||||
|
Loading…
Reference in New Issue
Block a user