summaryrefslogtreecommitdiffstats
path: root/src/H5.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-05-28 18:17:12 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-05-28 18:17:12 (GMT)
commitca912c389e4e641cfbae6facced950ad05578d65 (patch)
tree6bd8604f6a587ee07013ad40daa3c0c7f4b31c26 /src/H5.c
parent893cf5899c2b724aa438b66a275967b1f5ad0342 (diff)
downloadhdf5-ca912c389e4e641cfbae6facced950ad05578d65.zip
hdf5-ca912c389e4e641cfbae6facced950ad05578d65.tar.gz
hdf5-ca912c389e4e641cfbae6facced950ad05578d65.tar.bz2
[svn-r5467] Purpose:
Code cleanup. Description: Took Robb's recent ideas for improving the FUNC_ENTER/FUNC_LEAVE macros equivalents in the SAF library and adapted them to our library. I added an additional macro which is equivalent to FUNC_ENTER: FUNC_ENTER_NOINIT - Has the API tracing code, etc. from FUNC_ENTER but none of the library or interface initialization code. This is to be used _only_ for static functions and those which explicitly cannot have the library or interface initialization code enabled (like the API termination routines, etc.). This allowed many more of the functions in the library [but not all yet :-(] to be wrapped with FUNC_ENTER[_NOINIT]/FUNC_LEAVE pairs. It also reduced the size of the library and executables (by cutting out a bunch of code which was never executed), I'll e-mail the exact results when I've finished editing it. Platforms tested: IRIX64 6.5 (modi4)
Diffstat (limited to 'src/H5.c')
-rw-r--r--src/H5.c40
1 files changed, 13 insertions, 27 deletions
diff --git a/src/H5.c b/src/H5.c
index 47dd553..5182383 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -71,7 +71,7 @@ static int interface_initialize_g = 0;
herr_t
H5_init_library(void)
{
- FUNC_ENTER_INIT(H5_init_library, NULL, FAIL);
+ FUNC_ENTER(H5_init_library, FAIL);
/*
* Make sure the package information is updated.
@@ -172,7 +172,7 @@ H5_term_library(void)
/* Don't do anything if the library is already closed */
if (!(H5_INIT_GLOBAL))
- return;
+ goto done;
/* Check if we should display error output */
H5Eget_auto(&func,NULL);
@@ -215,9 +215,11 @@ H5_term_library(void)
/* Mark library as closed */
H5_INIT_GLOBAL = FALSE;
+done:
#ifdef H5_HAVE_THREADSAFE
H5_UNLOCK_API_MUTEX;
#endif
+ return;
}
@@ -249,24 +251,16 @@ H5_term_library(void)
herr_t
H5dont_atexit(void)
{
- /* FUNC_ENTER_INIT() should not be called */
+ FUNC_ENTER_NOINIT(H5dont_atexit);
-#ifdef H5_HAVE_THREADSAFE
- /* locking code explicitly since FUNC_ENTER is not called */
- H5_FIRST_THREAD_INIT;
- H5_LOCK_API_MUTEX;
-#endif
H5_trace(FALSE, "H5dont_atexit", "");
if (dont_atexit_g)
- return FAIL;
+ HRETURN(FAIL);
dont_atexit_g = TRUE;
- H5_trace(TRUE, NULL, "e", SUCCEED);
-#ifdef H5_HAVE_THREADSAFE
- H5_UNLOCK_API_MUTEX;
-#endif
- return(SUCCEED);
+
+ FUNC_LEAVE(SUCCEED);
}
@@ -501,7 +495,7 @@ H5check_version (unsigned majnum, unsigned minnum, unsigned relnum)
char substr[] = H5_VERS_SUBRELEASE;
static int checked = 0;
- /* Don't initialize the library quite yet */
+ FUNC_ENTER_NOINIT(H5check_version);
if (H5_VERS_MAJOR!=majnum || H5_VERS_MINOR!=minnum ||
H5_VERS_RELEASE!=relnum) {
@@ -518,7 +512,7 @@ H5check_version (unsigned majnum, unsigned minnum, unsigned relnum)
}
if (checked)
- return SUCCEED;
+ HRETURN(SUCCEED);
checked = 1;
/*
@@ -544,7 +538,7 @@ H5check_version (unsigned majnum, unsigned minnum, unsigned relnum)
H5_VERS_SUBRELEASE, H5_VERS_INFO);
}
- return SUCCEED;
+ FUNC_LEAVE(SUCCEED);
}
@@ -596,18 +590,11 @@ H5close (void)
* thing just to release it all right away. It is safe to call this
* function for an uninitialized library.
*/
-#ifdef H5_HAVE_THREADSAFE
- /* Explicitly lock the call since FUNC_ENTER is not called */
- H5_FIRST_THREAD_INIT;
- H5_LOCK_API_MUTEX;
-#endif
+ FUNC_ENTER_NOINIT(H5close);
H5_term_library();
-#ifdef H5_HAVE_THREADSAFE
- H5_UNLOCK_API_MUTEX;
-#endif
- return SUCCEED;
+ FUNC_LEAVE(SUCCEED);
}
@@ -2609,5 +2596,4 @@ error:
fprintf (out, ")");
}
HDfflush (out);
- return;
}