summaryrefslogtreecommitdiffstats
path: root/src/H5V.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-08-08 16:52:55 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-08-08 16:52:55 (GMT)
commitd8397a6f426227d09d20e647ce8b12b8c6295b2d (patch)
tree2943fbfd2bfb66cf167eb642835fdb4deb3afd3c /src/H5V.c
parent573307786a1f5f7ce597e5191ea08c3bbd95b66c (diff)
downloadhdf5-d8397a6f426227d09d20e647ce8b12b8c6295b2d.zip
hdf5-d8397a6f426227d09d20e647ce8b12b8c6295b2d.tar.gz
hdf5-d8397a6f426227d09d20e647ce8b12b8c6295b2d.tar.bz2
[svn-r5842] Purpose:
Code cleanup Description: Change most (all?) HRETURN_ERROR macros to HGOTO_ERROR macros, along with HRETURN macros to HGOTO_DONE macros. This unifies the error return path from functions and reduces the size of the library by up to 10% on some platforms. Additionally, I improved a lot of the error cleanup code in many routines. Platforms tested: FreeBSD 4.6 (sleipnir) serial & parallel and IRIX64 6.5 (modi4) serial & parallel.
Diffstat (limited to 'src/H5V.c')
-rw-r--r--src/H5V.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/H5V.c b/src/H5V.c
index db243c0..96bde6b 100644
--- a/src/H5V.c
+++ b/src/H5V.c
@@ -343,24 +343,28 @@ H5V_hyper_eq(int n,
{
hsize_t nelmts1 = 1, nelmts2 = 1;
int i;
+ htri_t ret_value=TRUE; /* Return value */
/* Use FUNC_ENTER_NOINIT here to avoid performance issues */
FUNC_ENTER_NOINIT(H5V_hyper_eq);
- if (n <= 0) HRETURN(TRUE);
+ if (n <= 0) HGOTO_DONE(TRUE);
for (i=0; i<n; i++) {
if ((offset1 ? offset1[i] : 0) != (offset2 ? offset2[i] : 0)) {
- HRETURN(FALSE);
+ HGOTO_DONE(FALSE);
}
if ((size1 ? size1[i] : 0) != (size2 ? size2[i] : 0)) {
- HRETURN(FALSE);
+ HGOTO_DONE(FALSE);
}
- if (0 == (nelmts1 *= (size1 ? size1[i] : 0))) HRETURN(FALSE);
- if (0 == (nelmts2 *= (size2 ? size2[i] : 0))) HRETURN(FALSE);
+ if (0 == (nelmts1 *= (size1 ? size1[i] : 0))) HGOTO_DONE(FALSE);
+ if (0 == (nelmts2 *= (size2 ? size2[i] : 0))) HGOTO_DONE(FALSE);
}
- FUNC_LEAVE(TRUE);
+
+done:
+ FUNC_LEAVE(ret_value);
}
+
/*-------------------------------------------------------------------------
* Function: H5V_hyper_disjointp
@@ -386,29 +390,33 @@ H5V_hyper_disjointp(unsigned n,
const hssize_t *offset2, const hsize_t *size2)
{
unsigned u;
+ htri_t ret_value=FALSE; /* Return value */
/* Use FUNC_ENTER_NOINIT here to avoid performance issues */
FUNC_ENTER_NOINIT(H5V_hyper_disjointp);
- if (!n || !size1 || !size2) HRETURN(TRUE);
+ if (!n || !size1 || !size2) HGOTO_DONE(TRUE);
for (u=0; u<n; u++) {
assert (size1[u]<HSSIZET_MAX);
assert (size2[u]<HSSIZET_MAX);
if (0==size1[u] || 0==size2[u])
- HRETURN(TRUE);
+ HGOTO_DONE(TRUE);
if (((offset1?offset1[u]:0) < (offset2?offset2[u]:0) &&
((offset1?offset1[u]:0) + (hssize_t)size1[u] <=
(offset2?offset2[u]:0))) ||
((offset2?offset2[u]:0) < (offset1?offset1[u]:0) &&
((offset2?offset2[u]:0) + (hssize_t)size2[u] <=
(offset1?offset1[u]:0)))) {
- HRETURN(TRUE);
+ HGOTO_DONE(TRUE);
}
}
- FUNC_LEAVE(FALSE);
+
+done:
+ FUNC_LEAVE(ret_value);
}
+
/*-------------------------------------------------------------------------
* Function: H5V_hyper_fill
@@ -783,10 +791,8 @@ H5V_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size,
} else {
H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t);
HDmemcpy (dst, src, (size_t)elmt_size);
- HRETURN (SUCCEED);
}
-
FUNC_LEAVE(SUCCEED);
}