diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2015-09-21 02:18:45 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2015-09-21 02:18:45 (GMT) |
commit | 0695d6366a670e1dd9b6b0ca463feec12ab659d7 (patch) | |
tree | baf248c43e42f8a479fb46dd21a916180575ac9b /src/H5E.c | |
parent | 68659dd411a8ca3b0b2ef86eaaa7d5ba5d5bc449 (diff) | |
parent | 8fc9a9ba251ea34ac5a943ad8eb7f6cf012b929d (diff) | |
download | hdf5-0695d6366a670e1dd9b6b0ca463feec12ab659d7.zip hdf5-0695d6366a670e1dd9b6b0ca463feec12ab659d7.tar.gz hdf5-0695d6366a670e1dd9b6b0ca463feec12ab659d7.tar.bz2 |
[svn-r27835] Description:
Sync w/trunk.
Tested on:
MacOSX/64 10.10.5 (amazon) w/serial & parallel
(h5committest not required on this branch)
Diffstat (limited to 'src/H5E.c')
-rw-r--r-- | src/H5E.c | 140 |
1 files changed, 69 insertions, 71 deletions
@@ -45,10 +45,7 @@ /* Module Setup */ /****************/ -#define H5E_PACKAGE /*suppress error about including H5Epkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5E_init_interface +#include "H5Emodule.h" /* This source code file is part of the H5E module */ /***********/ @@ -83,6 +80,7 @@ /* Local Prototypes */ /********************/ /* Static function declarations */ +static herr_t H5E_set_default_auto(H5E_t *stk); static H5E_cls_t *H5E_register_class(const char *cls_name, const char *lib_name, const char *version); static herr_t H5E_unregister_class(H5E_cls_t *cls); @@ -100,6 +98,9 @@ static ssize_t H5E_get_num(const H5E_t *err_stack); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -173,45 +174,7 @@ done: /*-------------------------------------------------------------------------- - * Function: H5E_set_default_auto - * - * Purpose: Initialize "automatic" error stack reporting info to library - * default - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Thursday, November 1, 2007 - * - *-------------------------------------------------------------------------- - */ -static herr_t -H5E_set_default_auto(H5E_t *stk) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#ifndef H5_NO_DEPRECATED_SYMBOLS -#ifdef H5_USE_16_API_DEFAULT - stk->auto_op.vers = 1; -#else /* H5_USE_16_API */ - stk->auto_op.vers = 2; -#endif /* H5_USE_16_API_DEFAULT */ - - stk->auto_op.func1 = stk->auto_op.func1_default = (H5E_auto1_t)H5Eprint1; - stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5Eprint2; - stk->auto_op.is_default = TRUE; -#else /* H5_NO_DEPRECATED_SYMBOLS */ - stk->auto_op.func2 = (H5E_auto2_t)H5Eprint2; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - - stk->auto_data = NULL; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_set_default_auto() */ - - -/*-------------------------------------------------------------------------- - * Function: H5E_init_interface + * Function: H5E__init_package * * Purpose: Initialize interface-specific information * @@ -222,15 +185,15 @@ H5E_set_default_auto(H5E_t *stk) * *-------------------------------------------------------------------------- */ -static herr_t -H5E_init_interface(void) +herr_t +H5E__init_package(void) { H5E_cls_t *cls; /* Pointer to error class */ H5E_msg_t *msg; /* Pointer to new error message */ char lib_vers[128]; /* Buffer to constructu library version within */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Initialize the atom group for the error class IDs */ if(H5I_register_type(H5I_ERRCLS_CLS) < 0) @@ -262,11 +225,11 @@ H5E_init_interface(void) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_init_interface() */ +} /* end H5E__init_package() */ /*------------------------------------------------------------------------- - * Function: H5E_term_interface + * Function: H5E_term_package * * Purpose: Terminates the H5E interface * @@ -281,13 +244,13 @@ done: *------------------------------------------------------------------------- */ int -H5E_term_interface(void) +H5E_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5_PKG_INIT_VAR) { int64_t ncls, nmsg, nstk; /* Check if there are any open error stacks, classes or messages */ @@ -323,22 +286,57 @@ H5E_term_interface(void) n++; /*H5I*/ } /* end if */ else { - /* Close deprecated interface */ - n += H5E__term_deprec_interface(); - /* Destroy the error class, message, and stack id groups */ - (void)H5I_dec_type_ref(H5I_ERROR_STACK); - (void)H5I_dec_type_ref(H5I_ERROR_CLASS); - (void)H5I_dec_type_ref(H5I_ERROR_MSG); - n++; /*H5I*/ + n += (H5I_dec_type_ref(H5I_ERROR_STACK) > 0); + n += (H5I_dec_type_ref(H5I_ERROR_CLASS) > 0); + n += (H5I_dec_type_ref(H5I_ERROR_MSG) > 0); /* Mark closed */ - H5_interface_initialize_g = 0; + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5E_term_interface() */ +} /* end H5E_term_package() */ + + +/*-------------------------------------------------------------------------- + * Function: H5E_set_default_auto + * + * Purpose: Initialize "automatic" error stack reporting info to library + * default + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, November 1, 2007 + * + *-------------------------------------------------------------------------- + */ +static herr_t +H5E_set_default_auto(H5E_t *stk) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#ifndef H5_NO_DEPRECATED_SYMBOLS +#ifdef H5_USE_16_API_DEFAULT + stk->auto_op.vers = 1; +#else /* H5_USE_16_API */ + stk->auto_op.vers = 2; +#endif /* H5_USE_16_API_DEFAULT */ + + stk->auto_op.func1 = stk->auto_op.func1_default = (H5E_auto1_t)H5Eprint1; + stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5Eprint2; + stk->auto_op.is_default = TRUE; +#else /* H5_NO_DEPRECATED_SYMBOLS */ + stk->auto_op.func2 = (H5E_auto2_t)H5Eprint2; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + stk->auto_data = NULL; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5E_set_default_auto() */ #ifdef H5_HAVE_THREADSAFE @@ -360,7 +358,7 @@ H5E_term_interface(void) H5E_t * H5E_get_stack(void) { - H5E_t *estack; + H5E_t *estack = NULL; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -371,7 +369,7 @@ H5E_get_stack(void) #ifdef H5_HAVE_WIN_THREADS estack = (H5E_t *)LocalAlloc(LPTR, sizeof(H5E_t)); /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */ #else - estack = (H5E_t *)H5FL_MALLOC(H5E_t); + estack = (H5E_t *)HDmalloc(sizeof(H5E_t)); #endif /* H5_HAVE_WIN_THREADS */ HDassert(estack); @@ -475,8 +473,8 @@ done: static H5E_cls_t * H5E_register_class(const char *cls_name, const char *lib_name, const char *version) { - H5E_cls_t *cls = NULL; /* Pointer to error class */ - H5E_cls_t *ret_value; /* Return value */ + H5E_cls_t *cls = NULL; /* Pointer to error class */ + H5E_cls_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -631,7 +629,7 @@ done: static ssize_t H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size) { - ssize_t len; /* Length of error class's name */ + ssize_t len = 0; /* Length of error class's name */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -812,8 +810,8 @@ done: static H5E_msg_t * H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str) { - H5E_msg_t *msg = NULL; /* Pointer to new error message */ - H5E_msg_t *ret_value; /* Return value */ + H5E_msg_t *msg = NULL; /* Pointer to new error message */ + H5E_msg_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -967,10 +965,10 @@ done: static H5E_t * H5E_get_current_stack(void) { - H5E_t *current_stack; /* Pointer to the current error stack */ - H5E_t *estack_copy=NULL; /* Pointer to new error stack to return */ - unsigned u; /* Local index variable */ - H5E_t *ret_value; /* Return value */ + H5E_t *current_stack; /* Pointer to the current error stack */ + H5E_t *estack_copy = NULL; /* Pointer to new error stack to return */ + unsigned u; /* Local index variable */ + H5E_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT |