From d4a3224c0fde991cdf65392aeeae326c46406121 Mon Sep 17 00:00:00 2001 From: Robb Matzke Date: Wed, 28 Jan 1998 16:43:08 -0500 Subject: [svn-r193] Changes since 19980128 ---------------------- ./MANIFEST Added new config files. ./src/H5private.h Changed FUNC_ENTER() so it calls H5Eclear() for all API functions but not for any private functions. It also prints the names of all API functions on file 55 (just for the prototype) so we can get a list of API functions called with the Bourne shell commands like: ./testhdf5 55>api_list or ./testhdf5 55>&1 1>/dev/null 2>&1 | less Otherwise the names are silently discarded. ./src/H5.c ./src/H5C.c ./src/H5D.c ./src/H5F.c ./src/H5G.c ./src/H5M.c ./src/H5P.c ./src/H5T.c Removed `H5ECLEAR' from lots of places in the source code. ./src/H5E.c ./src/H5Eprivate.h Recursion is a problem here, so to disable a call to H5Eclear() from FUNC_ENTER just define a local variable like this before you call FUNC_ENTER: const H5E_clearable_g = FALSE; Unfortunately this results in a warning: declaration of `H5E_clearable_g' shadows global declaration. Good thing it's only used in two places. --- MANIFEST | 3 +++ src/H5.c | 3 +-- src/H5C.c | 3 +-- src/H5D.c | 7 +----- src/H5E.c | 11 +++++---- src/H5Eprivate.h | 1 + src/H5F.c | 7 +----- src/H5G.c | 6 ----- src/H5M.c | 42 ++++++++++--------------------- src/H5P.c | 29 +++++----------------- src/H5T.c | 47 ++++++----------------------------- src/H5Tpkg.h | 6 ++--- src/H5private.h | 75 +++++++++++++++++++++++++++++++++----------------------- 13 files changed, 88 insertions(+), 152 deletions(-) diff --git a/MANIFEST b/MANIFEST index 78ef7c9..0960f34 100644 --- a/MANIFEST +++ b/MANIFEST @@ -13,7 +13,10 @@ ./config/conclude.in ./config/depend.in ./config/freebsd2.2.1 +./config/irix6.2 +./config/irix64 ./config/linux +./config/solaris2.5 ./configure.in ./html/CodeReview.html ./html/Datasets.html diff --git a/src/H5.c b/src/H5.c index e409489..abbc54d 100644 --- a/src/H5.c +++ b/src/H5.c @@ -302,8 +302,7 @@ H5version(uintn *majnum, uintn *minnum, uintn *relnum, uintn *patnum) FUNC_ENTER(H5version, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; + /* Check args and all the boring stuff. */ if (majnum == NULL || minnum == NULL || relnum == NULL || patnum == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "null pointer argument"); diff --git a/src/H5C.c b/src/H5C.c index d67fbdd..46dd841 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -888,9 +888,8 @@ H5Ccopy(hid_t tid) group_t group; FUNC_ENTER(H5Ccopy, FAIL); - H5ECLEAR; - /* check args */ + /* Check args */ if (NULL == (tmpl = H5A_object(tid)) || (type = H5Cget_class(tid)) < 0 || (group = H5A_group(tid)) < 0) { diff --git a/src/H5D.c b/src/H5D.c index 4433ab7..7d1a781 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -169,9 +169,8 @@ H5Dcreate(hid_t file_id, const char *name, hid_t type_id, hid_t space_id, const H5D_create_t *create_parms = NULL; FUNC_ENTER(H5Dcreate, FAIL); - H5ECLEAR; - /* check arguments */ + /* Check arguments */ if (H5_FILE != H5A_group(file_id) || NULL == (f = H5A_object(file_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); @@ -242,7 +241,6 @@ H5Dopen(hid_t file_id, const char *name) hid_t ret_value = FAIL; FUNC_ENTER(H5Dopen, FAIL); - H5ECLEAR; /* Check args */ if (H5_FILE != H5A_group(file_id) || @@ -295,7 +293,6 @@ H5Dclose(hid_t dataset_id) H5D_t *dataset = NULL; /* dataset object to release */ FUNC_ENTER(H5Dclose, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATASET != H5A_group(dataset_id) || @@ -414,7 +411,6 @@ H5Dread(hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, const H5D_xfer_t *xfer_parms = NULL; FUNC_ENTER(H5Dread, FAIL); - H5ECLEAR; /* check arguments */ if (H5_DATASET != H5A_group(dataset_id) || @@ -504,7 +500,6 @@ H5Dwrite(hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, const H5D_xfer_t *xfer_parms = NULL; FUNC_ENTER(H5Dwrite, FAIL); - H5ECLEAR; /* check arguments */ if (H5_DATASET != H5A_group(dataset_id) || diff --git a/src/H5E.c b/src/H5E.c index 71bdd80..f4fdda3 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -107,6 +107,7 @@ static intn interface_initialize_g = FALSE; static herr_t H5E_init_interface(void); static void H5E_term_interface(void); +const hbool_t H5E_clearable_g = TRUE; hid_t H5E_thrdid_g = FAIL; /* Thread-specific "global" error-handler ID */ /*-------------------------------------------------------------------------- @@ -184,9 +185,8 @@ H5Ecreate(uintn initial_stack_nelmts) hid_t ret_value = FAIL; FUNC_ENTER(H5Ecreate, FAIL); - H5ECLEAR; - /* check args */ + /* Check args */ initial_stack_nelmts = MAX(10, MIN(initial_stack_nelmts, 1000)); /* Allocate the stack header */ @@ -224,7 +224,6 @@ herr_t H5Eclose(hid_t estack_id) { FUNC_ENTER(H5Eclose, FAIL); - H5ECLEAR; /* check args */ if (H5_ERR != H5A_group(estack_id)) { @@ -329,7 +328,8 @@ DESCRIPTION herr_t H5Eclear(hid_t estack_id) { - H5E_t *estack = NULL; + H5E_t *estack = NULL; + hbool_t H5E_clearable_g = FALSE; /*override global*/ FUNC_ENTER(H5Eclear, FAIL); @@ -373,7 +373,8 @@ H5Eclear(hid_t estack_id) herr_t H5Eprint(hid_t estack_id, FILE * file) { - H5E_t *estack = NULL; + H5E_t *estack = NULL; + hbool_t H5E_clearable_g = FALSE; /*override global*/ FUNC_ENTER(H5Eprint, FAIL); /* diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 77bcab6..8b59828 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -122,6 +122,7 @@ typedef struct H5E_t { /* Private global variables in H5E.c */ extern hid_t H5E_thrdid_g; /* Thread-specific "global" error-handler ID */ extern hbool_t install_atexit; /* Whether to install the atexit routine */ +extern const hbool_t H5E_clearable_g; /* Safe to call H5Eclear() on enter?*/ herr_t H5E_close (H5E_t *estack); herr_t H5E_clear (H5E_t *estack); diff --git a/src/H5F.c b/src/H5F.c index 1c09c01..a07e134 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -233,7 +233,6 @@ H5Fget_create_template(hid_t fid) H5F_create_t *tmpl = NULL; FUNC_ENTER(H5Fget_create_template, FAIL); - H5ECLEAR; /* check args */ if (H5_FILE != H5A_group(fid)) { @@ -360,8 +359,7 @@ H5Fis_hdf5(const char *filename) FUNC_ENTER(H5Fis_hdf5, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; + /* Check args and all the boring stuff. */ if (filename == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no filename specified"); @@ -989,7 +987,6 @@ H5Fcreate(const char *filename, uintn flags, hid_t create_temp, hid_t ret_value = FAIL; FUNC_ENTER(H5Fcreate, FAIL); - H5ECLEAR; /* Check/fix arguments */ if (!filename || !*filename) @@ -1082,7 +1079,6 @@ H5Fopen(const char *filename, uintn flags, hid_t access_temp) hid_t ret_value = FAIL; FUNC_ENTER(H5Fopen, FAIL); - H5ECLEAR; /* Check/fix arguments. */ if (!filename || !*filename) @@ -1295,7 +1291,6 @@ H5Fclose(hid_t fid) herr_t ret_value = SUCCEED; FUNC_ENTER(H5Fclose, FAIL); - H5ECLEAR; /* Check/fix arguments. */ if (H5_FILE != H5A_group(fid)) diff --git a/src/H5G.c b/src/H5G.c index 7e470ae..dcd3fd3 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -92,7 +92,6 @@ H5Gcreate(hid_t file_id, const char *name, size_t size_hint) hid_t ret_value = FAIL; FUNC_ENTER(H5Gcreate, FAIL); - H5ECLEAR; /* Check arguments */ if (H5_FILE != H5A_group(file_id) || @@ -141,7 +140,6 @@ H5Gopen(hid_t file_id, const char *name) H5G_t *grp = NULL; FUNC_ENTER(H5Gopen, FAIL); - H5ECLEAR; /* Check args */ if (H5_FILE != H5A_group(file_id) || @@ -187,7 +185,6 @@ H5Gclose(hid_t grp_id) H5G_t *grp = NULL; FUNC_ENTER(H5Gclose, FAIL); - H5ECLEAR; /* Check args */ if (H5_GROUP != H5A_group(grp_id) || @@ -238,7 +235,6 @@ H5Gset(hid_t file_id, const char *name) H5G_t *grp; FUNC_ENTER(H5Gset, FAIL); - H5ECLEAR; /* Check/fix arguments */ if (H5_FILE != H5A_group(file_id) || @@ -297,7 +293,6 @@ H5Gpush(hid_t file_id, const char *name) H5G_t *grp; FUNC_ENTER(H5Gpush, FAIL); - H5ECLEAR; /* Check arguments */ if (H5_FILE != H5A_group(file_id) || @@ -357,7 +352,6 @@ H5Gpop(hid_t file_id) H5F_t *f = NULL; FUNC_ENTER(H5Gpop, FAIL); - H5ECLEAR; /* Check arguments */ if (H5_FILE != H5A_group(file_id) || diff --git a/src/H5M.c b/src/H5M.c index bd64a03..5466a1e 100644 --- a/src/H5M.c +++ b/src/H5M.c @@ -182,9 +182,6 @@ H5M_find_type(group_t type) FUNC_ENTER(H5M_find_type, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; - /* * Currently this uses a stright linear search, which can easily be changed * to a binary search when it becomes too slow. @@ -227,8 +224,7 @@ H5Maccess(hid_t oid) /* Atom group for incoming object */ group = H5A_group(oid); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; + /* Check args and all the boring stuff. */ if (group <= BADGROUP || group >= MAXGROUP) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); @@ -269,8 +265,7 @@ H5Mcopy(hid_t oid) FUNC_ENTER(H5Mcopy, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; + /* Check args and all the boring stuff. */ if (group <= BADGROUP || group >= MAXGROUP) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); @@ -314,8 +309,7 @@ H5Mfind_name(hid_t owner_id, group_t type, const char *name) FUNC_ENTER(H5Mfind_name, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; + /* Check args and all the boring stuff. */ #ifdef OLD_WAY if (group <= BADGROUP || group >= MAXGROUP) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL); @@ -362,8 +356,7 @@ H5Mname_len(hid_t oid) FUNC_ENTER(H5Mname_len, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; + /* Check args and all the boring stuff. */ if (group <= BADGROUP || group >= MAXGROUP) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); @@ -404,8 +397,7 @@ H5Mget_name(hid_t oid, char *name) FUNC_ENTER(H5Mget_name, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; + /* Check args and all the boring stuff. */ if (group <= BADGROUP || group >= MAXGROUP) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); @@ -447,8 +439,7 @@ H5Mset_name(hid_t oid, const char *name) FUNC_ENTER(H5Mset_name, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; + /* Check args and all the boring stuff. */ if (group <= BADGROUP || group >= MAXGROUP) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); @@ -491,8 +482,7 @@ H5Msearch(hid_t oid, group_t type, const char *name) FUNC_ENTER(H5Msearch, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; + /* Check args and all the boring stuff. */ if (group <= BADGROUP || group >= MAXGROUP) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); @@ -534,8 +524,7 @@ H5Mindex(hid_t oid, group_t type, uint32 idx) FUNC_ENTER(H5Mindex, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; + /* Check args and all the boring stuff. */ if (group <= BADGROUP || group >= MAXGROUP) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); @@ -575,8 +564,7 @@ H5Mflush(hid_t oid) FUNC_ENTER(H5Mflush, FAIL); /* Insert function initialization code and variables */ - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; + /* Check args and all the boring stuff. */ group = H5A_group(oid); /* look up group for incoming object */ if (group <= BADGROUP || group >= MAXGROUP) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); @@ -619,8 +607,7 @@ H5Mdelete(hid_t oid) FUNC_ENTER(H5Mdelete, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; + /* Check args and all the boring stuff. */ if (group <= BADGROUP || group >= MAXGROUP) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); @@ -660,8 +647,7 @@ H5Mget_parent(hid_t oid) FUNC_ENTER(H5Mget_parent, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; + /* Check args and all the boring stuff. */ if (group <= BADGROUP || group >= MAXGROUP) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); @@ -702,8 +688,7 @@ H5Mget_file(hid_t oid) FUNC_ENTER(H5Mget_file, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; + /* Check args and all the boring stuff. */ if (group <= BADGROUP || group >= MAXGROUP) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); @@ -744,8 +729,7 @@ H5Mclose(hid_t oid) FUNC_ENTER(H5Mclose, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; + /* Check args and all the boring stuff. */ if (group <= BADGROUP || group >= MAXGROUP) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "bad group"); diff --git a/src/H5P.c b/src/H5P.c index 6a4e5dc..5ecdbc6 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -108,7 +108,6 @@ H5Pcreate_simple(int rank, size_t dims[]) hid_t ret_value = FAIL; FUNC_ENTER(H5Pcreate, FAIL); - H5ECLEAR; ds = H5MM_xcalloc(1, sizeof(H5P_t)); ds->type = H5P_SIMPLE; @@ -160,7 +159,6 @@ H5Pcreate(H5P_class_t type) hid_t ret_value = FAIL; FUNC_ENTER(H5Pcreate, FAIL); - H5ECLEAR; ds = H5MM_xcalloc(1, sizeof(H5P_t)); ds->type = type; @@ -218,9 +216,8 @@ herr_t H5Pclose(hid_t space_id) { FUNC_ENTER(H5Pclose, FAIL); - H5ECLEAR; - /* check args */ + /* Check args */ if (H5_DATASPACE != H5A_group(space_id) || NULL == H5A_object(space_id)) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); @@ -376,9 +373,8 @@ H5Pget_npoints(hid_t space_id) size_t ret_value = 0; FUNC_ENTER(H5Pget_npoints, 0); - H5ECLEAR; - /* check args */ + /* Check args */ if (H5_DATASPACE != H5A_group(space_id) || NULL == (ds = H5A_object(space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a data space"); @@ -472,9 +468,8 @@ H5Pget_ndims(hid_t space_id) size_t ret_value = 0; FUNC_ENTER(H5Pget_ndims, FAIL); - H5ECLEAR; - /* check args */ + /* Check args */ if (H5_DATASPACE != H5A_group(space_id) || NULL == (ds = H5A_object(space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); @@ -559,9 +554,8 @@ H5Pget_dims(hid_t space_id, size_t dims[]/*out*/) size_t ret_value = 0; FUNC_ENTER(H5Pget_dims, FAIL); - H5ECLEAR; - /* check args */ + /* Check args */ if (H5_DATASPACE != H5A_group(space_id) || NULL == (ds = H5A_object(space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); @@ -834,9 +828,7 @@ H5P_is_simple(const H5P_t *sdim) FUNC_ENTER(H5P_is_simple, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; - + /* Check args and all the boring stuff. */ assert(sdim); ret_value = sdim->type == H5P_SIMPLE ? TRUE : FALSE; /* Currently all dataspaces are simple, but check anyway */ @@ -866,9 +858,7 @@ H5Pis_simple(hid_t sid) FUNC_ENTER(H5Pis_simple, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; - + /* Check args and all the boring stuff. */ if ((space = H5A_object(sid)) == NULL) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space"); @@ -913,9 +903,6 @@ H5Pset_space(hid_t sid, int rank, const size_t *dims) FUNC_ENTER(H5Pset_space, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; - /* Get the object */ if ((space = H5A_object(sid)) == NULL) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space"); @@ -1035,9 +1022,6 @@ H5Pset_hyperslab(hid_t sid, const intn *start, const intn *count, const intn *st FUNC_ENTER(H5Pset_hyperslab, FAIL); - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; - /* Get the object */ if (H5_DATASPACE != H5A_group(sid) || (space = H5A_object(sid)) == NULL) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space"); @@ -1116,7 +1100,6 @@ H5Pget_hyperslab (hid_t sid, int offset[]/*out*/, int size[]/*out*/, intn ret_value = FAIL; FUNC_ENTER (H5Pget_hyperslab, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATASPACE!=H5A_group (sid) || NULL==(ds=H5A_object (sid))) { diff --git a/src/H5T.c b/src/H5T.c index df1bd0f..4cc405f 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -347,14 +347,14 @@ H5Tcopy(hid_t type_id) hid_t ret_value = FAIL; FUNC_ENTER(H5Tcopy, FAIL); - H5ECLEAR; - /* check args */ + /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || NULL == (dt = H5A_object(type_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); } - /* copy */ + + /* Copy */ if (NULL == (new_dt = H5T_copy(dt))) { HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't copy"); } @@ -389,9 +389,8 @@ H5Tclose(hid_t type_id) H5T_t *dt = NULL; FUNC_ENTER(H5Tclose, FAIL); - H5ECLEAR; - /* check args */ + /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || NULL == (dt = H5A_object(type_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); @@ -505,7 +504,6 @@ H5Tget_class(hid_t type_id) H5T_t *dt = NULL; FUNC_ENTER(H5Tget_class, H5T_NO_CLASS); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -540,7 +538,6 @@ H5Tget_size(hid_t type_id) size_t size; FUNC_ENTER(H5Tget_size, 0); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -588,7 +585,6 @@ H5Tset_size(hid_t type_id, size_t size) size_t prec, offset; FUNC_ENTER(H5Tset_size, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -685,7 +681,6 @@ H5Tget_order(hid_t type_id) H5T_order_t order; FUNC_ENTER(H5Tget_order, H5T_ORDER_ERROR); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -722,7 +717,6 @@ H5Tset_order(hid_t type_id, H5T_order_t order) H5T_t *dt = NULL; FUNC_ENTER(H5Tset_order, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -768,7 +762,6 @@ H5Tget_precision(hid_t type_id) size_t prec; FUNC_ENTER(H5Tget_precision, 0); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -819,7 +812,6 @@ H5Tset_precision(hid_t type_id, size_t prec) size_t offset, size; FUNC_ENTER(H5Tset_prec, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -926,7 +918,6 @@ H5Tget_offset(hid_t type_id) size_t offset; FUNC_ENTER(H5Tget_offset, 0); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -985,7 +976,6 @@ H5Tset_offset(hid_t type_id, size_t offset) H5T_t *dt = NULL; FUNC_ENTER(H5Tset_offset, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1034,7 +1024,6 @@ H5Tget_pad(hid_t type_id, H5T_pad_t *lsb /*out */ , H5T_pad_t *msb /*out */ ) H5T_t *dt = NULL; FUNC_ENTER(H5Tget_pad, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1044,9 +1033,9 @@ H5Tget_pad(hid_t type_id, H5T_pad_t *lsb /*out */ , H5T_pad_t *msb /*out */ ) } /* Get values */ if (lsb) - *lsb = (H5T_pad_t)dt->u.atomic.lsb_pad; + *lsb = dt->u.atomic.lsb_pad; if (msb) - *msb = (H5T_pad_t)dt->u.atomic.msb_pad; + *msb = dt->u.atomic.msb_pad; FUNC_LEAVE(SUCCEED); } @@ -1073,7 +1062,6 @@ H5Tset_pad(hid_t type_id, H5T_pad_t lsb, H5T_pad_t msb) H5T_t *dt = NULL; FUNC_ENTER(H5Tset_pad, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1116,7 +1104,6 @@ H5Tget_sign(hid_t type_id) H5T_sign_t sign; FUNC_ENTER(H5Tget_sign, H5T_SGN_ERROR); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1153,7 +1140,6 @@ H5Tset_sign(hid_t type_id, H5T_sign_t sign) H5T_t *dt = NULL; FUNC_ENTER(H5Tset_sign, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1202,7 +1188,6 @@ H5Tget_fields(hid_t type_id, size_t *spos /*out */ , H5T_t *dt = NULL; FUNC_ENTER(H5Tget_fields, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1255,7 +1240,6 @@ H5Tset_fields(hid_t type_id, size_t spos, size_t epos, size_t esize, H5T_t *dt = NULL; FUNC_ENTER(H5Tset_fields, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1326,7 +1310,6 @@ H5Tget_ebias(hid_t type_id) size_t ebias; FUNC_ENTER(H5Tget_ebias, 0); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1363,7 +1346,6 @@ H5Tset_ebias(hid_t type_id, size_t ebias) H5T_t *dt = NULL; FUNC_ENTER(H5Tset_ebias, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1404,7 +1386,6 @@ H5Tget_norm(hid_t type_id) H5T_norm_t norm; FUNC_ENTER(H5Tget_norm, H5T_NORM_ERROR); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1442,7 +1423,6 @@ H5Tset_norm(hid_t type_id, H5T_norm_t norm) H5T_t *dt = NULL; FUNC_ENTER(H5Tset_norm, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1488,7 +1468,6 @@ H5Tget_inpad(hid_t type_id) H5T_pad_t pad; FUNC_ENTER(H5Tget_inpad, H5T_PAD_ERROR); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1498,7 +1477,7 @@ H5Tget_inpad(hid_t type_id) "not a floating-point data type"); } /* pad */ - pad = (H5T_pad_t)dt->u.atomic.u.f.pad; + pad = dt->u.atomic.u.f.pad; FUNC_LEAVE(pad); } @@ -1528,7 +1507,6 @@ H5Tset_inpad(hid_t type_id, H5T_pad_t pad) H5T_t *dt = NULL; FUNC_ENTER(H5Tset_inpad, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1574,7 +1552,6 @@ H5Tget_cset(hid_t type_id) H5T_cset_t cset; FUNC_ENTER(H5Tget_cset, H5T_CSET_ERROR); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1613,7 +1590,6 @@ H5Tset_cset(hid_t type_id, H5T_cset_t cset) H5T_t *dt = NULL; FUNC_ENTER(H5Tset_cset, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1659,7 +1635,6 @@ H5Tget_strpad(hid_t type_id) H5T_str_t strpad; FUNC_ENTER(H5Tget_strpad, H5T_STR_ERROR); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1699,7 +1674,6 @@ H5Tset_strpad(hid_t type_id, H5T_str_t strpad) H5T_t *dt = NULL; FUNC_ENTER(H5Tset_strpad, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1744,7 +1718,6 @@ H5Tget_nmembers(hid_t type_id) H5T_t *dt = NULL; FUNC_ENTER(H5Tget_num_members, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1782,7 +1755,6 @@ H5Tget_member_name(hid_t type_id, int membno) char *s = NULL; FUNC_ENTER(H5Tget_member_name, NULL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1824,7 +1796,6 @@ H5Tget_member_offset(hid_t type_id, int membno) size_t offset = 0; FUNC_ENTER(H5Tget_member_offset, 0); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1866,7 +1837,6 @@ H5Tget_member_dims(hid_t type_id, int membno, intn ndims, i; FUNC_ENTER(H5Tget_member_dims, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1915,7 +1885,6 @@ H5Tget_member_type(hid_t type_id, int membno) hid_t memb_type_id; FUNC_ENTER(H5Tget_member_type, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || @@ -1974,7 +1943,6 @@ H5Tinsert(hid_t parent_id, const char *name, off_t offset, hid_t member_id) H5T_t *member = NULL; /*the atomic member type */ FUNC_ENTER(H5Tinsert, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(parent_id) || @@ -2022,7 +1990,6 @@ H5Tpack(hid_t type_id) H5T_t *dt = NULL; FUNC_ENTER(H5Tpack, FAIL); - H5ECLEAR; /* Check args */ if (H5_DATATYPE != H5A_group(type_id) || diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 7c86500..90aa54a 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -22,8 +22,8 @@ typedef struct H5T_atomic_t { H5T_order_t order; /*byte order */ size_t prec; /*precision in bits */ size_t offset; /*bit position of lsb of value */ - intn lsb_pad;/*type of lsb padding */ - intn msb_pad;/*type of msb padding */ + H5T_pad_t lsb_pad;/*type of lsb padding */ + H5T_pad_t msb_pad;/*type of msb padding */ union { struct { H5T_sign_t sign; /*type of integer sign */ @@ -37,7 +37,7 @@ typedef struct H5T_atomic_t { size_t mpos; /*position of lsb of mantissa */ size_t msize; /*size of mantissa */ H5T_norm_t norm; /*normalization */ - intn pad; /*type of padding for internal bits */ + H5T_pad_t pad; /*type of padding for internal bits */ } f; /*floating-point types */ struct { diff --git a/src/H5private.h b/src/H5private.h index 9fa402e..995b53d 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -422,38 +422,53 @@ extern char *strdup(const char *s); extern hbool_t library_initialize_g; /*good thing C's lazy about extern! */ extern hbool_t thread_initialize_g; /*don't decl interface_initialize_g */ +#define PRINT(N,S) { \ + write ((N), (S), strlen((S))); \ + write ((N), "\n", 1); \ +} + #define FUNC_ENTER(func_name,err) FUNC_ENTER_INIT(func_name,INTERFACE_INIT,err) -#define FUNC_ENTER_INIT(func_name,interface_init_func,err) { \ - CONSTR (FUNC, #func_name); \ - PABLO_SAVE (ID_ ## func_name); \ - \ - PABLO_TRACE_ON (PABLO_MASK, pablo_func_id); \ - \ - if (!library_initialize_g) { \ - library_initialize_g = TRUE; \ - if (H5_init_library()<0) { \ - HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ - "library initialization failed"); \ - } \ - } \ - \ - if (!thread_initialize_g) { \ - thread_initialize_g = TRUE; \ - if (H5_init_thread()<0) { \ - HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ - "thread initialization failed"); \ - } \ - } \ - \ - if (!interface_initialize_g) { \ - interface_initialize_g = TRUE; \ - if (interface_init_func && \ - ((herr_t(*)(void))interface_init_func)()<0) { \ - HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ - "interface initialization failed"); \ - } \ - } \ +#define FUNC_ENTER_INIT(func_name,interface_init_func,err) { \ + CONSTR (FUNC, #func_name); \ + PABLO_SAVE (ID_ ## func_name); \ + \ + PABLO_TRACE_ON (PABLO_MASK, pablo_func_id); \ + \ + /* Initialize the library */ \ + if (!library_initialize_g) { \ + library_initialize_g = TRUE; \ + if (H5_init_library()<0) { \ + HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ + "library initialization failed"); \ + } \ + } \ + \ + /* Initialize this thread */ \ + if (!thread_initialize_g) { \ + thread_initialize_g = TRUE; \ + if (H5_init_thread()<0) { \ + HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ + "thread initialization failed"); \ + } \ + } \ + \ + /* Initialize this interface */ \ + if (!interface_initialize_g) { \ + interface_initialize_g = TRUE; \ + if (interface_init_func && \ + ((herr_t(*)(void))interface_init_func)()<0) { \ + HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ + "interface initialization failed"); \ + } \ + } \ + \ + /* Clear thread error stack entering public functions */ \ + if (H5E_clearable_g && '_'!=#func_name[2] && '_'!=#func_name[3] && \ + (!#func_name[4] || '_'!=#func_name[4])) { \ + PRINT (55, #func_name); \ + H5Eclear (H5E_thrdid_g); \ + } \ { /*------------------------------------------------------------------------- -- cgit v0.12