summaryrefslogtreecommitdiffstats
path: root/src/H5E.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/H5E.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/H5E.c')
-rw-r--r--src/H5E.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/H5E.c b/src/H5E.c
index bf50045..fffe1b8 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -212,17 +212,21 @@ void *H5E_auto_data_g = NULL;
*
*-------------------------------------------------------------------------
*/
-H5E_t *H5E_get_stack(void)
+H5E_t *
+H5E_get_stack(void)
{
- H5E_t *estack = pthread_getspecific(H5TS_errstk_key_g);
+ H5E_t *estack;
+ FUNC_ENTER(H5E_get_stack,NULL);
+
+ estack = pthread_getspecific(H5TS_errstk_key_g);
if (!estack) {
/* no associated value with current thread - create one */
estack = (H5E_t *)H5MM_malloc(sizeof(H5E_t));
pthread_setspecific(H5TS_errstk_key_g, (void *)estack);
}
- return estack;
+ FUNC_LEAVE(estack);
}
#endif /* H5_HAVE_THREADSAFE */
@@ -248,9 +252,11 @@ H5E_t *H5E_get_stack(void)
static herr_t
H5E_init_interface (void)
{
- FUNC_ENTER(H5E_init_interface, FAIL);
- H5E_auto_data_g = stderr;
- FUNC_LEAVE(SUCCEED);
+ FUNC_ENTER_NOINIT(H5E_init_interface);
+
+ H5E_auto_data_g = stderr;
+
+ FUNC_LEAVE(SUCCEED);
}
@@ -472,6 +478,7 @@ H5Ewalk_cb(int n, H5E_error_t *err_desc, void *client_data)
const char *min_str = NULL;
const int indent = 2;
+ FUNC_ENTER_NOINIT(H5Ewalk_cb);
/*NO TRACE*/
/* Check arguments */
@@ -491,7 +498,7 @@ H5Ewalk_cb(int n, H5E_error_t *err_desc, void *client_data)
fprintf (stream, "%*sminor(%02d): %s\n",
indent*2, "", err_desc->min_num, min_str);
- return SUCCEED;
+ FUNC_LEAVE(SUCCEED);
}
@@ -524,13 +531,14 @@ H5Eget_major (H5E_major_t n)
* traversal and adding/removing entries as the result of an
* error would most likely mess things up.
*/
+ FUNC_ENTER_NOINIT(H5Eget_major);
+
for (i=0; i<NELMTS (H5E_major_mesg_g); i++) {
- if (H5E_major_mesg_g[i].error_code==n) {
- return H5E_major_mesg_g[i].str;
- }
+ if (H5E_major_mesg_g[i].error_code==n)
+ HRETURN(H5E_major_mesg_g[i].str);
}
- return "Invalid major error number";
+ FUNC_LEAVE("Invalid major error number");
}
@@ -563,13 +571,14 @@ H5Eget_minor (H5E_minor_t n)
* traversal and adding/removing entries as the result of an
* error would most likely mess things up.
*/
+ FUNC_ENTER_NOINIT(H5Eget_minor);
+
for (i=0; i<NELMTS (H5E_minor_mesg_g); i++) {
- if (H5E_minor_mesg_g[i].error_code==n) {
- return H5E_minor_mesg_g[i].str;
- }
+ if (H5E_minor_mesg_g[i].error_code==n)
+ HRETURN(H5E_minor_mesg_g[i].str);
}
- return "Invalid minor error number";
+ FUNC_LEAVE("Invalid minor error number");
}