diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2002-08-08 16:52:55 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2002-08-08 16:52:55 (GMT) |
commit | d8397a6f426227d09d20e647ce8b12b8c6295b2d (patch) | |
tree | 2943fbfd2bfb66cf167eb642835fdb4deb3afd3c /src/H5.c | |
parent | 573307786a1f5f7ce597e5191ea08c3bbd95b66c (diff) | |
download | hdf5-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.c | 42 |
1 files changed, 21 insertions, 21 deletions
@@ -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); } |