summaryrefslogtreecommitdiffstats
path: root/src/H5Dio.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2015-04-18 06:39:34 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2015-04-18 06:39:34 (GMT)
commit1eaaae98214d9042e979209e93e31c490efa4d79 (patch)
tree45b2258e7edc6ef8040b6e5339cf2e313d883b8f /src/H5Dio.c
parent524bfed32ef710dd28a3ff400965f01893a3f66b (diff)
downloadhdf5-1eaaae98214d9042e979209e93e31c490efa4d79.zip
hdf5-1eaaae98214d9042e979209e93e31c490efa4d79.tar.gz
hdf5-1eaaae98214d9042e979209e93e31c490efa4d79.tar.bz2
[svn-r26842] Description:
Cache the dataset's rank & dimension sizes, instead of querying them frequently, to speed up various checks & algorithms. Also, a few minor cleanups. Tested on: MacOSX/64 10.10.2 (amazon) w/serial & parallel Linux/32 2.6.18 (jam) w/serial & parallel
Diffstat (limited to 'src/H5Dio.c')
-rw-r--r--src/H5Dio.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 1c77d93..44080dc 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -302,8 +302,6 @@ H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id,
uint32_t direct_filters;
hsize_t *direct_offset;
uint32_t direct_datasize;
- int ndims = 0;
- hsize_t dims[H5O_LAYOUT_NDIMS];
hsize_t internal_offset[H5O_LAYOUT_NDIMS];
unsigned u; /* Local index variable */
@@ -324,12 +322,9 @@ H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id,
/* The library's chunking code requires the offset terminates with a zero. So transfer the
* offset array to an internal offset array */
- if((ndims = H5S_get_simple_extent_dims(dset->shared->space, dims, NULL)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve dataspace extent dims")
-
- for(u = 0; u < (unsigned)ndims; u++) {
+ for(u = 0; u < dset->shared->ndims; u++) {
/* Make sure the offset doesn't exceed the dataset's dimensions */
- if(direct_offset[u] > dims[u])
+ if(direct_offset[u] > dset->shared->curr_dims[u])
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset")
/* Make sure the offset fall right on a chunk's boundary */
@@ -340,7 +335,7 @@ H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id,
} /* end for */
/* Terminate the offset with a zero */
- internal_offset[ndims] = 0;
+ internal_offset[dset->shared->ndims] = 0;
/* write raw data */
if(H5D__chunk_direct_write(dset, dxpl_id, direct_filters, internal_offset, direct_datasize, buf) < 0)