[svn-r7347] Purpose:

Code cleanup & bug fix

Description:
    Clean up code, adding error checking where appropriate

    Fix a number of routines which were clearing the default error stack
before checking some information about that stack.

    Set the version # of the library correctly when it is registered.

Platforms tested:
    FreeBSD 4.8 (sleipnir)
    h5committested
This commit is contained in:
Quincey Koziol 2003-08-12 08:29:41 -05:00
parent 1c03bdd2ff
commit 9a2f9731bd
4 changed files with 747 additions and 334 deletions

1056
src/H5E.c

File diff suppressed because it is too large Load Diff

View File

@ -57,7 +57,6 @@ typedef struct H5E_print_t {
/* HDF5 error class */
#define H5E_CLS_NAME "HDF5"
#define H5E_CLS_LIB_NAME "HDF5"
#define H5E_CLS_LIB_VERS "" /* How to find out version number? */
/* HDF5 error class: major errors */
#define H5E_MAJ_ARGS_MSG "Function arguments"
@ -249,26 +248,10 @@ typedef struct H5E_print_t {
*/
#define HGOTO_DONE(ret_val) {ret_value = ret_val; goto done;}
H5_DLL hid_t H5E_register_class(const char *cls_name, const char *lib_name,
const char *version);
H5_DLL herr_t H5E_unregister_class(H5E_cls_t *cls);
H5_DLL herr_t H5E_close_msg(H5E_msg_t *err);
H5_DLL hid_t H5E_create_msg(hid_t cls_id, H5E_type_t msg_type, const char *msg);
H5_DLL hid_t H5E_get_current_stack(void);
H5_DLL herr_t H5E_close_stack(H5E_t *err_stack);
H5_DLL ssize_t H5E_get_class_name(H5E_cls_t *cls, char *name, size_t size);
H5_DLL ssize_t H5E_get_msg(H5E_msg_t *msg_ptr, H5E_type_t *type, char *msg, size_t size);
H5_DLL int H5E_get_num(H5E_t *err_stack);
H5_DLL herr_t H5E_set_current_stack(H5E_t *estack);
/* Library-private functions defined in H5E package */
H5_DLL herr_t H5E_push(H5E_t *estack, const char *file, const char *func, unsigned line,
hid_t cls_id, hid_t maj_id, hid_t min_id, const char *desc);
H5_DLL herr_t H5E_pop(H5E_t *err_stack, size_t count);
H5_DLL herr_t H5E_clear(H5E_t *estack);
H5_DLL herr_t H5E_print(H5E_t *estack, FILE *stream);
H5_DLL herr_t H5E_walk (H5E_t *estack, H5E_direction_t direction, H5E_walk_t func,
void *client_data);
H5_DLL herr_t H5E_get_auto(H5E_t *estack, H5E_auto_t *func, void **client_data);
H5_DLL herr_t H5E_set_auto(H5E_t *estack, H5E_auto_t func, void *client_data);
H5_DLL herr_t H5E_dump_api_stack(int is_api);
#ifdef H5_HAVE_PARALLEL

View File

@ -32,10 +32,8 @@
/* Take out _new later */
typedef enum H5E_type_t {
H5E_LLIMIT =-1,
H5E_MAJOR,
H5E_MINOR,
H5E_ULIMIT
H5E_MINOR
} H5E_type_t;
/* Information about an error; element of error stack */

View File

@ -185,8 +185,6 @@ init_error(void)
char *msg = malloc(strlen(ERR_MIN_SUBROUTINE_MSG)+1);
H5E_type_t *msg_type= malloc(sizeof(H5E_type_t));
if((ERR_CLS = H5Eregister_class(ERR_CLS_NAME, PROG_NAME, PROG_VERS))<0)
TEST_ERROR;
if((ERR_CLS = H5Eregister_class(ERR_CLS_NAME, PROG_NAME, PROG_VERS))<0)
TEST_ERROR;