summaryrefslogtreecommitdiffstats
path: root/src/H5.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/H5.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/H5.c')
-rw-r--r--src/H5.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/H5.c b/src/H5.c
index 529c4ba..3f7f34a 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -71,6 +71,8 @@ static int interface_initialize_g = 0;
herr_t
H5_init_library(void)
{
+ herr_t ret_value=SUCCEED;
+
FUNC_ENTER_NOAPI(H5_init_library, FAIL);
/*
@@ -115,28 +117,21 @@ H5_init_library(void)
* & dataset interfaces though, in order to provide them with the proper
* property classes.
*/
- if (H5P_init()<0) {
- HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL,
- "unable to initialize property list interface");
- }
- if (H5F_init()<0) {
- HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL,
- "unable to initialize file interface");
- }
- if (H5T_init()<0) {
- HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL,
- "unable to initialize datatype interface");
- }
- if (H5D_init()<0) {
- HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL,
- "unable to initialize dataset interface");
- }
+ if (H5P_init()<0)
+ HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize property list interface");
+ if (H5F_init()<0)
+ HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize file interface");
+ if (H5T_init()<0)
+ HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize datatype interface");
+ if (H5D_init()<0)
+ HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize dataset interface");
/* Debugging? */
H5_debug_mask("-all");
H5_debug_mask(HDgetenv("HDF5_DEBUG"));
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -252,16 +247,19 @@ done:
herr_t
H5dont_atexit(void)
{
+ herr_t ret_value=SUCCEED; /* Return value */
+
FUNC_ENTER_API_NOINIT(H5dont_atexit);
H5_trace(FALSE, "H5dont_atexit", "");
if (dont_atexit_g)
- HRETURN(FAIL);
+ HGOTO_DONE(FAIL);
dont_atexit_g = TRUE;
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}
@@ -495,6 +493,7 @@ H5check_version (unsigned majnum, unsigned minnum, unsigned relnum)
char lib_str[256];
char substr[] = H5_VERS_SUBRELEASE;
static int checked = 0;
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT(H5check_version);
@@ -513,7 +512,7 @@ H5check_version (unsigned majnum, unsigned minnum, unsigned relnum)
}
if (checked)
- HRETURN(SUCCEED);
+ HGOTO_DONE(SUCCEED);
checked = 1;
/*
@@ -539,7 +538,8 @@ H5check_version (unsigned majnum, unsigned minnum, unsigned relnum)
H5_VERS_SUBRELEASE, H5_VERS_INFO);
}
- FUNC_LEAVE(SUCCEED);
+done:
+ FUNC_LEAVE(ret_value);
}