summaryrefslogtreecommitdiffstats
path: root/src/H5Sselect.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2019-11-18 19:33:36 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2019-11-18 19:33:36 (GMT)
commit4e12984b77cdd7615843d94f8de8d54db27476ac (patch)
tree7db096e4acbf035781fefbcb1e6868e4ec0ccfed /src/H5Sselect.c
parent4064332a2dc45e591666ce1bff02001239009bb8 (diff)
downloadhdf5-4e12984b77cdd7615843d94f8de8d54db27476ac.zip
hdf5-4e12984b77cdd7615843d94f8de8d54db27476ac.tar.gz
hdf5-4e12984b77cdd7615843d94f8de8d54db27476ac.tar.bz2
Move checking for zero offset in selection adjust calls to the selection callbacks. This makes the
procedure for checking it consistent across selection types and between _s and _u, ensures it is always is performed even when called within the H5S package, and removes the redundant check that would occur when callins H5S_select_adjust_s() from outside the H5S package.
Diffstat (limited to 'src/H5Sselect.c')
-rw-r--r--src/H5Sselect.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 70d971e..b722b49 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -947,8 +947,6 @@ H5S_select_is_regular(const H5S_t *space)
herr_t
H5S_select_adjust_u(H5S_t *space, const hsize_t *offset)
{
- hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */
- unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -957,16 +955,8 @@ H5S_select_adjust_u(H5S_t *space, const hsize_t *offset)
HDassert(space);
HDassert(offset);
- /* Check for an all-zero offset vector */
- for(u = 0; u < space->extent.rank; u++)
- if(0 != offset[u]) {
- non_zero_offset = TRUE;
- break;
- } /* end if */
-
- /* Only perform operation if the offset is non-zero */
- if(non_zero_offset)
- ret_value = (*space->select.type->adjust_u)(space, offset);
+ /* Perform operation */
+ ret_value = (*space->select.type->adjust_u)(space, offset);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_adjust_u() */
@@ -996,8 +986,6 @@ H5S_select_adjust_u(H5S_t *space, const hsize_t *offset)
herr_t
H5S_select_adjust_s(H5S_t *space, const hssize_t *offset)
{
- hbool_t non_zero_offset = FALSE; /* Whether any offset is non-zero */
- unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1006,16 +994,8 @@ H5S_select_adjust_s(H5S_t *space, const hssize_t *offset)
HDassert(space);
HDassert(offset);
- /* Check for an all-zero offset vector */
- for(u = 0; u < space->extent.rank; u++)
- if(0 != offset[u]) {
- non_zero_offset = TRUE;
- break;
- } /* end if */
-
- /* Only perform operation if the offset is non-zero */
- if(non_zero_offset)
- ret_value = (*space->select.type->adjust_s)(space, offset);
+ /* Perform operation */
+ ret_value = (*space->select.type->adjust_s)(space, offset);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_adjust_s() */