diff options
-rw-r--r-- | src/H5.c | 40 | ||||
-rw-r--r-- | src/H5A.c | 16 | ||||
-rw-r--r-- | src/H5AC.c | 21 | ||||
-rw-r--r-- | src/H5B.c | 11 | ||||
-rw-r--r-- | src/H5D.c | 21 | ||||
-rw-r--r-- | src/H5Distore.c | 30 | ||||
-rw-r--r-- | src/H5E.c | 39 | ||||
-rw-r--r-- | src/H5Eprivate.h | 25 | ||||
-rw-r--r-- | src/H5F.c | 45 | ||||
-rw-r--r-- | src/H5FD.c | 12 | ||||
-rw-r--r-- | src/H5FDcore.c | 2 | ||||
-rw-r--r-- | src/H5FDmpio.c | 4 | ||||
-rw-r--r-- | src/H5FDstream.c | 286 | ||||
-rw-r--r-- | src/H5FL.c | 54 | ||||
-rw-r--r-- | src/H5Fistore.c | 30 | ||||
-rw-r--r-- | src/H5G.c | 29 | ||||
-rw-r--r-- | src/H5Gnode.c | 11 | ||||
-rw-r--r-- | src/H5HG.c | 2 | ||||
-rw-r--r-- | src/H5HL.c | 5 | ||||
-rw-r--r-- | src/H5I.c | 9 | ||||
-rw-r--r-- | src/H5MM.c | 21 | ||||
-rw-r--r-- | src/H5MMprivate.h | 1 | ||||
-rw-r--r-- | src/H5O.c | 12 | ||||
-rw-r--r-- | src/H5Odtype.c | 4 | ||||
-rw-r--r-- | src/H5P.c | 138 | ||||
-rw-r--r-- | src/H5R.c | 16 | ||||
-rw-r--r-- | src/H5S.c | 6 | ||||
-rw-r--r-- | src/H5Shyper.c | 78 | ||||
-rw-r--r-- | src/H5Smpio.c | 14 | ||||
-rw-r--r-- | src/H5Sselect.c | 10 | ||||
-rw-r--r-- | src/H5T.c | 16 | ||||
-rw-r--r-- | src/H5TB.c | 14 | ||||
-rw-r--r-- | src/H5Tbit.c | 23 | ||||
-rw-r--r-- | src/H5Tconv.c | 4 | ||||
-rw-r--r-- | src/H5Tvlen.c | 5 | ||||
-rw-r--r-- | src/H5V.c | 26 | ||||
-rw-r--r-- | src/H5Vprivate.h | 47 | ||||
-rw-r--r-- | src/H5Z.c | 2 | ||||
-rw-r--r-- | src/H5detect.c | 4 | ||||
-rw-r--r-- | src/H5private.h | 85 |
40 files changed, 675 insertions, 543 deletions
@@ -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; } @@ -60,7 +60,7 @@ DESCRIPTION static herr_t H5A_init_interface(void) { - FUNC_ENTER(H5A_init_interface, FAIL); + FUNC_ENTER_NOINIT(H5A_init_interface); /* * Create attribute group. @@ -95,6 +95,8 @@ int H5A_term_interface(void) { int n=0; + + FUNC_ENTER_NOINIT(H5A_term_interface); if (interface_initialize_g) { if ((n=H5I_nmembers(H5I_ATTR))) { @@ -105,7 +107,7 @@ H5A_term_interface(void) n = 1; } } - return n; + FUNC_LEAVE(n); } @@ -220,7 +222,7 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type, int seq=0; hid_t ret_value = FAIL; - FUNC_ENTER(H5A_create, FAIL); + FUNC_ENTER_NOINIT(H5A_create); /* check args */ assert(ent); @@ -320,7 +322,7 @@ H5A_get_index(H5G_entry_t *ent, const char *name) H5A_t found_attr; int ret_value=FAIL, i; - FUNC_ENTER(H5A_get_index, FAIL); + FUNC_ENTER_NOINIT(H5A_get_index); assert(ent); assert(name); @@ -495,7 +497,7 @@ H5A_open(H5G_entry_t *ent, unsigned idx) H5A_t *attr = NULL; hid_t ret_value = FAIL; - FUNC_ENTER(H5A_open, FAIL); + FUNC_ENTER_NOINIT(H5A_open); /* check args */ assert(ent); @@ -613,7 +615,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf) int idx; /* index of attribute in object header */ herr_t ret_value = FAIL; - FUNC_ENTER(H5A_write, FAIL); + FUNC_ENTER_NOINIT(H5A_write); assert(attr); assert(mem_type); @@ -766,7 +768,7 @@ H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf) size_t buf_size; /* desired buffer size */ herr_t ret_value = FAIL; - FUNC_ENTER(H5A_read, FAIL); + FUNC_ENTER_NOINIT(H5A_read); assert(attr); assert(mem_type); @@ -331,34 +331,37 @@ H5AC_compare(const void *_a, const void *_b) int a = *((const int *) _a); int b = *((const int *) _b); + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5AC_compare); + assert(current_cache_g); if(NULL==current_cache_g->slot[a] || NULL == current_cache_g->slot[b]) { if(NULL==current_cache_g->slot[a]) { if (NULL == current_cache_g->slot[b]) { - return 0; + HRETURN(0); } else { - return -1; + HRETURN(-1); } } else { - return 1; + HRETURN(1); } } else if (NULL == current_cache_g->slot[a]->type) { if (NULL == current_cache_g->slot[b]->type) { - return 0; + HRETURN(0); } else { - return -1; + HRETURN(-1); } } else if (NULL == current_cache_g->slot[b]->type) { - return 1; + HRETURN(1); } else if (current_cache_g->slot[a]->addr < current_cache_g->slot[b]->addr) { - return -1; + HRETURN(-1); } else if (current_cache_g->slot[a]->addr > current_cache_g->slot[b]->addr) { - return 1; + HRETURN(1); } - return 0; + FUNC_LEAVE(0); } #endif @@ -679,7 +679,7 @@ H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, haddr_t old_addr, int i, k, nleft, nright; size_t recsize = 0; - FUNC_ENTER(H5B_split, FAIL); + FUNC_ENTER_NOINIT(H5B_split); /* * Check arguments. @@ -834,7 +834,7 @@ H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, haddr_t old_addr, static herr_t H5B_decode_key(H5F_t *f, H5B_t *bt, int idx) { - FUNC_ENTER(H5B_decode_key, FAIL); + FUNC_ENTER_NOINIT(H5B_decode_key); bt->key[idx].nkey = bt->native + idx * bt->type->sizeof_nkey; if ((bt->type->decode) (f, bt, bt->key[idx].rkey, @@ -862,7 +862,7 @@ H5B_decode_key(H5F_t *f, H5B_t *bt, int idx) static herr_t H5B_decode_keys(H5F_t *f, H5B_t *bt, int idx) { - FUNC_ENTER(H5B_decode_keys, FAIL); + FUNC_ENTER_NOINIT(H5B_decode_keys); assert(f); assert(bt); @@ -1084,7 +1084,8 @@ H5B_insert_child(H5F_t *f, const H5B_class_t *type, H5B_t *bt, size_t recsize; int i; - FUNC_ENTER(H5B_insert_child, FAIL); + FUNC_ENTER_NOINIT(H5B_insert_child); + assert(bt); assert(bt->nchildren<2*H5B_Kvalue(f, type)); @@ -1214,7 +1215,7 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, H5B_ins_t my_ins = H5B_INS_ERROR; H5B_ins_t ret_value = H5B_INS_ERROR; - FUNC_ENTER(H5B_insert_helper, H5B_INS_ERROR); + FUNC_ENTER_NOINIT(H5B_insert_helper); /* * Check arguments @@ -184,7 +184,7 @@ H5D_init_interface(void) size_t nprops; /* Number of properties */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER(H5D_init_interface, FAIL); + FUNC_ENTER_NOINIT(H5D_init_interface); /* Initialize the atom group for the dataset IDs */ if (H5I_init_group(H5I_DATASET, H5I_DATASETID_HASHSIZE, H5D_RESERVED_ATOMS, (H5I_free_t)H5D_close)<0) @@ -357,6 +357,8 @@ H5D_term_interface(void) { int n=0; + FUNC_ENTER_NOINIT(H5D_term_interface); + if (interface_initialize_g) { if ((n=H5I_nmembers(H5I_DATASET))) { H5I_clear_group(H5I_DATASET, FALSE); @@ -366,7 +368,7 @@ H5D_term_interface(void) n = 1; /*H5I*/ } } - return n; + FUNC_LEAVE(n); } @@ -983,7 +985,7 @@ static herr_t H5D_get_space_status(H5D_t *dset, H5D_space_status_t *allocation) hsize_t full_size; /* The number of bytes in the dataset when fully populated */ herr_t ret_value = SUCCEED; - FUNC_ENTER(H5D_get_space_status, FAIL); + FUNC_ENTER_NOINIT(H5D_get_space_status); /* Get the dataset's dataspace */ if((space=H5D_get_space(dset))==NULL) @@ -3086,10 +3088,6 @@ done: FUNC_LEAVE (ret_value); } - - - - /*------------------------------------------------------------------------- * Function: H5D_entof @@ -3110,7 +3108,10 @@ done: H5G_entry_t * H5D_entof (H5D_t *dataset) { - return dataset ? &(dataset->ent) : NULL; + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5D_entof); + + FUNC_LEAVE( dataset ? &(dataset->ent) : NULL); } @@ -3202,7 +3203,7 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space) H5P_genplist_t *plist; /* Property list */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER(H5D_init_storage, FAIL); + FUNC_ENTER_NOINIT(H5D_init_storage); assert(dset); assert(space); @@ -3736,7 +3737,7 @@ H5D_fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_t size_t buf_size; /* Desired buffer size */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER (H5D_fill, FAIL); + FUNC_ENTER_NOINIT(H5D_fill); /* Check args */ assert(buf); diff --git a/src/H5Distore.c b/src/H5Distore.c index a0f7497..3b8b7a5 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -317,6 +317,9 @@ H5F_istore_sizeof_rkey(H5F_t UNUSED *f, const void *_udata) const H5F_istore_ud1_t *udata = (const H5F_istore_ud1_t *) _udata; size_t nbytes; + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5F_istore_sizeof_rkey); + assert(udata); assert(udata->mesg.ndims > 0 && udata->mesg.ndims <= H5O_LAYOUT_NDIMS); @@ -324,7 +327,7 @@ H5F_istore_sizeof_rkey(H5F_t UNUSED *f, const void *_udata) 4 + /*filter mask */ udata->mesg.ndims*8; /*dimension indices */ - return nbytes; + FUNC_LEAVE(nbytes); } @@ -863,9 +866,10 @@ H5F_istore_iter_allocated (H5F_t UNUSED *f, void *_lt_key, haddr_t UNUSED addr, H5F_istore_ud1_t *bt_udata = (H5F_istore_ud1_t *)_udata; H5F_istore_key_t *lt_key = (H5F_istore_key_t *)_lt_key; - FUNC_ENTER(H5F_istore_iterate, FAIL); + FUNC_ENTER_NOINIT(H5F_istore_iterate); bt_udata->total_storage += lt_key->nbytes; + FUNC_LEAVE(SUCCEED); } /* H5F_istore_iter_allocated() */ @@ -899,7 +903,7 @@ H5F_istore_iter_dump (H5F_t UNUSED *f, void *_lt_key, haddr_t UNUSED addr, H5F_istore_key_t *lt_key = (H5F_istore_key_t *)_lt_key; unsigned u; - FUNC_ENTER(H5F_istore_iterate, FAIL); + FUNC_ENTER_NOINIT(H5F_istore_iterate); if (bt_udata->stream) { if (0==bt_udata->total_storage) { @@ -985,7 +989,8 @@ H5F_istore_flush_entry(H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) size_t alloc; /*bytes allocated for BUF */ hbool_t point_of_no_return = FALSE; - FUNC_ENTER(H5F_istore_flush_entry, FAIL); + FUNC_ENTER_NOINIT(H5F_istore_flush_entry); + assert(f); assert(ent); assert(!ent->locked); @@ -1103,7 +1108,7 @@ H5F_istore_preempt(H5F_t *f, H5F_rdcc_ent_t * ent, hbool_t flush) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); - FUNC_ENTER(H5F_istore_preempt, FAIL); + FUNC_ENTER_NOINIT(H5F_istore_preempt); assert(f); assert(ent); @@ -1280,7 +1285,7 @@ H5F_istore_prune (H5F_t *f, size_t size) H5F_rdcc_ent_t *p[2], *cur; /*list pointers */ H5F_rdcc_ent_t *n[2]; /*list next pointers */ - FUNC_ENTER (H5F_istore_prune, FAIL); + FUNC_ENTER_NOINIT(H5F_istore_prune); /* * Preemption is accomplished by having multiple pointers (currently two) @@ -1415,7 +1420,7 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, void *ret_value=NULL; /*return value */ H5P_genplist_t *plist=NULL; /* Property list */ - FUNC_ENTER (H5F_istore_lock, NULL); + FUNC_ENTER_NOINIT(H5F_istore_lock); if (rdcc->nslots>0) { /* We don't care about loss of precision in the following statement. */ @@ -1682,7 +1687,7 @@ H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, unsigned u; H5P_genplist_t *plist; /* Property list */ - FUNC_ENTER (H5F_istore_unlock, FAIL); + FUNC_ENTER_NOINIT(H5F_istore_unlock); if (UINT_MAX==*idx_hint) { /*not in cache*/ @@ -2351,7 +2356,7 @@ H5F_istore_get_addr(H5F_t *f, const H5O_layout_t *layout, unsigned u; haddr_t ret_value=HADDR_UNDEF; /* Return value */ - FUNC_ENTER (H5F_istore_get_addr, HADDR_UNDEF); + FUNC_ENTER_NOINIT(H5F_istore_get_addr); assert(f); assert(layout && (layout->ndims > 0)); @@ -2776,7 +2781,7 @@ H5F_istore_prune_extent(H5F_t *f, void *_lt_key, haddr_t UNUSED addr, * storage that contains the beginning of the logical address space represented by UDATA. */ - FUNC_ENTER(H5F_istore_prune_extent, FAIL); + FUNC_ENTER_NOINIT(H5F_istore_prune_extent); /* Figure out what chunks are no longer in use for the specified extent and release them */ for(u = 0; u < bt_udata->mesg.ndims - 1; u++) @@ -2832,10 +2837,13 @@ H5F_istore_remove(H5F_t *f, haddr_t addr, void *_lt_key /*in,out */ , { H5F_istore_key_t *lt_key = (H5F_istore_key_t *)_lt_key; + FUNC_ENTER(H5F_istore_remove,H5B_INS_ERROR); + H5FD_free(f->shared->lf, H5FD_MEM_DRAW, addr, (hsize_t)lt_key->nbytes); *lt_key_changed = FALSE; *rt_key_changed = FALSE; - return H5B_INS_REMOVE; + + FUNC_LEAVE(H5B_INS_REMOVE); } @@ -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"); } diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index c0f6fd2..d6466b7 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -31,16 +31,22 @@ #define HERROR(maj, min, str) H5E_push(maj, min, FUNC, __FILE__, __LINE__, str) /* + * HCOMMON_ERROR macro, used by HRETURN_ERROR and HGOTO_ERROR + * (Shouldn't need to be used outside this header file) + */ +#define HCOMMON_ERROR(maj, min, str) \ + HERROR (maj, min, str); \ + if (H5_IS_API(FUNC) && H5E_auto_g) \ + (H5E_auto_g)(H5E_auto_data_g) + +/* * HRETURN_ERROR macro, used to facilitate error reporting between a * FUNC_ENTER() and a FUNC_LEAVE() within a function body. The arguments are * the major error number, the minor error number, a return value, and a * description of the error. */ #define HRETURN_ERROR(maj, min, ret_val, str) { \ - HERROR (maj, min, str); \ - if (H5_IS_API(FUNC) && H5E_auto_g) { \ - (H5E_auto_g)(H5E_auto_data_g); \ - } \ + HCOMMON_ERROR (maj, min, str); \ HRETURN(ret_val); \ } @@ -52,8 +58,7 @@ #define HRETURN(ret_val) { \ PABLO_TRACE_OFF (PABLO_MASK, pablo_func_id); \ H5TRACE_RETURN(ret_val); \ - H5_API_UNLOCK_BEGIN \ - H5_API_UNLOCK_END \ + H5_API_UNLOCK \ H5_API_SET_CANCEL \ return (ret_val); \ } @@ -66,12 +71,8 @@ * control branches to the `done' label. */ #define HGOTO_ERROR(maj, min, ret_val, str) { \ - HERROR (maj, min, str); \ - if (H5_IS_API(FUNC) && H5E_auto_g) { \ - (H5E_auto_g)(H5E_auto_data_g); \ - } \ - ret_value = ret_val; \ - goto done; \ + HCOMMON_ERROR (maj, min, str); \ + HGOTO_DONE (ret_val); \ } /* @@ -207,7 +207,7 @@ H5F_init_interface(void) H5P_genclass_t *mnt_pclass; hbool_t local = H5F_MNT_SYM_LOCAL_DEF; - FUNC_ENTER(H5F_init_interface, FAIL); + FUNC_ENTER_NOINIT(H5F_init_interface); #ifdef H5_HAVE_PARALLEL { @@ -438,6 +438,8 @@ H5F_term_interface(void) { int n = 0; + FUNC_ENTER_NOINIT(H5F_term_interface); + if (interface_initialize_g) { if ((n=H5I_nmembers(H5I_FILE))) { H5F_close_all(); @@ -448,7 +450,7 @@ H5F_term_interface(void) n = 1; /*H5I*/ } } - return n; + FUNC_LEAVE(n); } @@ -631,8 +633,12 @@ static int H5F_flush_all_cb(H5F_t *f, hid_t UNUSED fid, const void *_invalidate) { hbool_t invalidate = *((const hbool_t*)_invalidate); + + FUNC_ENTER_NOINIT(H5F_flush_all_cb); + H5F_flush(f, H5F_SCOPE_LOCAL, invalidate, FALSE, FALSE); - return 0; + + FUNC_LEAVE(0); } @@ -921,7 +927,8 @@ H5F_get_obj_count(H5F_t *f, unsigned types, unsigned *obj_id_count) { herr_t ret_value = SUCCEED; - FUNC_ENTER(H5F_get_obj_count, FAIL); + FUNC_ENTER_NOINIT(H5F_get_obj_count); + *obj_id_count = 0; if(H5F_get_objects(f, types, NULL, obj_id_count) < 0) @@ -987,7 +994,7 @@ H5F_get_obj_ids(H5F_t *f, unsigned types, hid_t *oid_list) { herr_t ret_value = SUCCEED; - FUNC_ENTER(H5F_get_obj_ids, FAIL); + FUNC_ENTER_NOINIT(H5F_get_obj_ids); if(H5F_get_objects(f, types, oid_list, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get object IDs opened in the file"); @@ -1019,7 +1026,7 @@ H5F_get_objects(H5F_t *f, unsigned types, hid_t *obj_id_list, herr_t ret_value = SUCCEED; H5F_olist_t *olist = NULL; - FUNC_ENTER(H5F_get_object, FAIL); + FUNC_ENTER_NOINIT(H5F_get_object); olist = H5MM_malloc(sizeof(H5F_olist_t)); olist->obj_id_list = obj_id_list; @@ -1090,7 +1097,8 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) H5F_olist_t *olist = key; H5G_entry_t *ent = NULL; - FUNC_ENTER(H5F_get_objects_cb, FAIL); + FUNC_ENTER_NOINIT(H5F_get_objects_cb); + assert(obj_ptr); assert(olist); @@ -1162,8 +1170,10 @@ H5F_equal(void *_haystack, hid_t UNUSED id, const void *_needle) const H5FD_t *needle = (const H5FD_t*)_needle; int retval; - FUNC_ENTER(H5F_equal, FAIL); + FUNC_ENTER_NOINIT(H5F_equal); + retval = (0==H5FD_cmp(haystack->shared->lf, needle)); + FUNC_LEAVE(retval); } @@ -1194,7 +1204,7 @@ H5F_locate_signature(H5FD_t *file) uint8_t buf[H5F_SIGNATURE_LEN]; unsigned n, maxpow; - FUNC_ENTER(H5F_locate_signature, HADDR_UNDEF); + FUNC_ENTER_NOINIT(H5F_locate_signature); /* Find the least N such that 2^N is larger than the file size */ if (HADDR_UNDEF==(addr=H5FD_get_eof(file)) || @@ -1325,7 +1335,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id) #endif /* H5_HAVE_PARALLEL */ H5P_genplist_t *plist; /* Property list */ - FUNC_ENTER(H5F_new, NULL); + FUNC_ENTER_NOINIT(H5F_new); if (NULL==(f=H5FL_ALLOC(H5F_t,1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); @@ -1451,7 +1461,7 @@ H5F_dest(H5F_t *f) { herr_t ret_value = SUCCEED; - FUNC_ENTER(H5F_dest, FAIL); + FUNC_ENTER_NOINIT(H5F_dest); if (f && 1==f->nrefs) { if (1==f->shared->nrefs) { @@ -2287,7 +2297,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, unsigned sym_leaf_k; H5P_genplist_t *plist; /* Property list */ - FUNC_ENTER(H5F_flush, FAIL); + FUNC_ENTER_NOINIT(H5F_flush); /* * Nothing to do if the file is read only. This determination is made at @@ -2719,7 +2729,8 @@ H5F_mount(H5G_entry_t *loc, const char *name, H5F_t *child, H5G_entry_t *ent = NULL; /*temporary symbol table entry */ herr_t ret_value = FAIL; /*return value */ - FUNC_ENTER(H5F_mount, FAIL); + FUNC_ENTER_NOINIT(H5F_mount); + assert(loc); assert(name && *name); assert(child); @@ -2834,7 +2845,8 @@ H5F_unmount(H5G_entry_t *loc, const char *name) unsigned i; /*coutners */ int lt, rt, md=(-1), cmp; /*binary search indices */ - FUNC_ENTER(H5F_unmount, FAIL); + FUNC_ENTER_NOINIT(H5F_unmount); + assert(loc); assert(name && *name); @@ -3515,6 +3527,9 @@ herr_t H5F_addr_pack(H5F_t UNUSED *f, haddr_t *addr_p/*out*/, const unsigned long objno[2]) { + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5F_addr_pack); + assert(f); assert(objno); assert(addr_p); @@ -3524,7 +3539,7 @@ H5F_addr_pack(H5F_t UNUSED *f, haddr_t *addr_p/*out*/, *addr_p |= ((uint64_t)objno[1]) << (8*sizeof(long)); #endif - return(SUCCEED); + FUNC_LEAVE(SUCCEED); } @@ -72,7 +72,7 @@ static unsigned long file_serial_no[2]; static herr_t H5FD_init_interface(void) { - FUNC_ENTER(H5FD_init_interface, FAIL); + FUNC_ENTER_NOINIT(H5FD_init_interface); if (H5I_init_group(H5I_VFL, H5I_VFL_HASHSIZE, 0, (H5I_free_t)H5FD_free_cls)<0) { @@ -112,6 +112,8 @@ H5FD_term_interface(void) { int n = 0; + FUNC_ENTER_NOINIT(H5_term_interface); + if (interface_initialize_g) { if ((n=H5I_nmembers(H5I_VFL))) { H5I_clear_group(H5I_VFL, FALSE); @@ -121,7 +123,7 @@ H5FD_term_interface(void) n = 1; /*H5I*/ } } - return n; + FUNC_LEAVE(n); } @@ -146,8 +148,10 @@ H5FD_term_interface(void) static herr_t H5FD_free_cls(H5FD_class_t *cls) { - FUNC_ENTER(H5FD_free_cls, FAIL); + FUNC_ENTER_NOINIT(H5FD_free_cls); + H5MM_xfree(cls); + FUNC_LEAVE(SUCCEED); } @@ -1483,7 +1487,7 @@ H5FD_real_alloc(H5FD_t *file, H5FD_mem_t type, hsize_t size) { haddr_t ret_value = HADDR_UNDEF; - FUNC_ENTER(H5FD_real_alloc, HADDR_UNDEF); + FUNC_ENTER_NOINIT(H5FD_real_alloc); /* Check args */ assert(file && file->cls); diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 16f3192..47bb551 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -311,7 +311,7 @@ H5FD_core_open(const char *name, unsigned UNUSED flags, hid_t fapl_id, H5P_genplist_t *plist; /* Property list pointer */ int fd=-1; - FUNC_ENTER(H5FD_init_interface, NULL); + FUNC_ENTER(H5FD_core_open, NULL); /* Check arguments */ if (0==maxaddr || HADDR_UNDEF==maxaddr) diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 3d58e4d..7792032 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1709,7 +1709,7 @@ MPIOff_to_haddr(MPI_Offset mpi_off) { haddr_t ret_value=HADDR_UNDEF; - FUNC_ENTER(MPIOff_to_haddr, HADDR_UNDEF); + FUNC_ENTER_NOINIT(MPIOff_to_haddr); if (mpi_off != (MPI_Offset)(haddr_t)mpi_off) ret_value=HADDR_UNDEF; @@ -1750,7 +1750,7 @@ haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off/*out*/) { herr_t ret_value=FAIL; - FUNC_ENTER(haddr_to_MPIOff, FAIL); + FUNC_ENTER_NOINIT(haddr_to_MPIOff); if (mpi_off) *mpi_off = (MPI_Offset)addr; diff --git a/src/H5FDstream.c b/src/H5FDstream.c index 97617ca..ec2c351 100644 --- a/src/H5FDstream.c +++ b/src/H5FDstream.c @@ -357,7 +357,8 @@ herr_t H5Pget_fapl_stream(hid_t fapl_id, H5FD_stream_fapl_t *fapl /* out */) * *------------------------------------------------------------------------- */ -static void *H5FD_stream_fapl_get (H5FD_t *_stream) +static void * +H5FD_stream_fapl_get (H5FD_t *_stream) { H5FD_stream_t *stream = (H5FD_stream_t *) _stream; H5FD_stream_fapl_t *fapl; @@ -377,60 +378,49 @@ static void *H5FD_stream_fapl_get (H5FD_t *_stream) static H5FD_STREAM_SOCKET_TYPE -H5FDstream_open_socket (const char *filename, int o_flags, - H5FD_stream_fapl_t *fapl, - const char **errormsg, - H5E_major_t *major, H5E_minor_t *minor) +H5FD_stream_open_socket (const char *filename, int o_flags, + H5FD_stream_fapl_t *fapl) { struct sockaddr_in server; struct hostent *he; - H5FD_STREAM_SOCKET_TYPE sock; - char *hostname; + H5FD_STREAM_SOCKET_TYPE sock=H5FD_STREAM_INVALID_SOCKET; + char *hostname=NULL; unsigned short int first_port; const char *separator, *tmp; int on = 1; + H5FD_STREAM_SOCKET_TYPE ret_value=H5FD_STREAM_INVALID_SOCKET; - - sock = H5FD_STREAM_INVALID_SOCKET; - *errormsg = NULL; + FUNC_ENTER_NOINIT(H5FD_stream_open_socket); /* Parse "hostname:port" from filename argument */ - for (separator = filename; *separator != ':' && *separator; separator++); + for (separator = filename; *separator != ':' && *separator; separator++) + ; if (separator == filename || !*separator) { - *errormsg = "invalid host address"; + HGOTO_ERROR(H5E_ARGS,H5E_BADVALUE,H5FD_STREAM_INVALID_SOCKET,"invalid host address"); } else { tmp = separator; if (! tmp[1]) { - *errormsg = "no port number"; + HGOTO_ERROR(H5E_ARGS,H5E_BADVALUE,H5FD_STREAM_INVALID_SOCKET,"no port number"); } - while (*errormsg == NULL && *++tmp) + while (*++tmp) { if (! isdigit (*tmp)) { - *errormsg = "invalid port number"; + HGOTO_ERROR(H5E_ARGS,H5E_BADVALUE,H5FD_STREAM_INVALID_SOCKET,"invalid port number"); } } } - /* Return if parsing the filename failed */ - if (*errormsg) - { - *major = H5E_ARGS; *minor = H5E_BADVALUE; - return (sock); - } - hostname = (char *) H5MM_malloc ((size_t)(separator - filename + 1)); /* Return if out of memory */ if (hostname == NULL) { - *major = H5E_RESOURCE; *minor = H5E_NOSPACE; - *errormsg = "memory allocation failed"; - return (sock); + HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"memory allocation failed"); } HDstrncpy (hostname, filename, (size_t)(separator - filename)); @@ -443,15 +433,13 @@ H5FDstream_open_socket (const char *filename, int o_flags, if (! (he = gethostbyname (hostname))) { - *errormsg = "unable to get host address"; + HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to get host address"); } else if (H5FD_STREAM_ERROR_CHECK (sock = socket (AF_INET, SOCK_STREAM, 0))) { - *errormsg = "unable to open socket"; + HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to open socket"); } - if (*errormsg == NULL) - { if (O_RDONLY == o_flags) { HDmemcpy (&server.sin_addr, he->h_addr, (size_t)he->h_length); @@ -461,7 +449,7 @@ H5FDstream_open_socket (const char *filename, int o_flags, #endif if (connect (sock, (struct sockaddr *) &server, sizeof (server)) < 0) { - *errormsg = "unable to connect"; + HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to connect"); } } else @@ -469,17 +457,17 @@ H5FDstream_open_socket (const char *filename, int o_flags, server.sin_addr.s_addr = INADDR_ANY; if (H5FD_STREAM_IOCTL_SOCKET (sock, FIONBIO, &on) < 0) { - *errormsg = "unable to set non-blocking mode for socket"; + HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to set non-blocking mode for socket"); } else if (setsockopt (sock, IPPROTO_TCP, TCP_NODELAY, (const char *) &on, sizeof(on)) < 0) { - *errormsg = "unable to set socket option TCP_NODELAY"; + HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to set socket option TCP_NODELAY"); } else if (setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, (const char *) &on, sizeof(on)) < 0) { - *errormsg = "unable to set socket option SO_REUSEADDR"; + HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to set socket option SO_REUSEADDR"); } else { @@ -504,44 +492,42 @@ H5FDstream_open_socket (const char *filename, int o_flags, if (fapl->port > first_port + fapl->maxhunt) { fapl->port = 0; - *errormsg = "unable to bind socket"; + HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to bind socket"); } else if (listen (sock, fapl->backlog) < 0) { - *errormsg = "unable to listen on socket"; + HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to listen on socket"); } } } - } - H5MM_xfree (hostname); + /* Set return value for success */ + ret_value=sock; - /* Return if opening the socket failed */ - if (*errormsg) - { - if (! H5FD_STREAM_ERROR_CHECK (sock)) - { - H5FD_STREAM_CLOSE_SOCKET (sock); - sock = H5FD_STREAM_INVALID_SOCKET; - } - *major = H5E_FILE; *minor = H5E_CANTOPENFILE; - } +done: + /* Cleanup variables */ + if(hostname!=NULL) + hostname=H5MM_xfree(hostname); - return (sock); + /* Clean up on error */ + if(ret_value==H5FD_STREAM_INVALID_SOCKET) { + if (!H5FD_STREAM_ERROR_CHECK(sock)) + H5FD_STREAM_CLOSE_SOCKET(sock); + } /* end if */ + FUNC_LEAVE(ret_value); } -static void H5FDstream_read_from_socket (H5FD_stream_t *stream, - const char **errormsg, - H5E_major_t *major, H5E_minor_t *minor) +static herr_t +H5FD_stream_read_from_socket (H5FD_stream_t *stream) { int size; size_t max_size = 0; - unsigned char *ptr; + unsigned char *ptr=NULL; + herr_t ret_value=SUCCEED; + FUNC_ENTER_NOINIT(H5FD_stream_read_from_socket); - ptr = NULL; - *errormsg = NULL; stream->eof = 0; stream->mem = NULL; @@ -562,9 +548,7 @@ static void H5FDstream_read_from_socket (H5FD_stream_t *stream, ptr = H5MM_realloc (stream->mem, (size_t) (stream->eof + max_size)); if (! ptr) { - *major = H5E_RESOURCE; *minor = H5E_NOSPACE; - *errormsg = "unable to allocate file space buffer"; - return; + HRETURN_ERROR(H5E_RESOURCE,H5E_NOSPACE,FAIL,"unable to allocate file space buffer"); } stream->mem = ptr; ptr += stream->eof; @@ -579,9 +563,7 @@ static void H5FDstream_read_from_socket (H5FD_stream_t *stream, } if (size < 0) { - *major = H5E_IO; *minor = H5E_READERROR; - *errormsg = "error reading from file from socket"; - return; + HRETURN_ERROR(H5E_IO,H5E_READERROR,FAIL,"error reading from file from socket"); } if (! size) { @@ -600,6 +582,7 @@ static void H5FDstream_read_from_socket (H5FD_stream_t *stream, fprintf (stderr, "Stream VFD: read total of %d bytes from socket\n", (int) stream->eof); #endif + FUNC_LEAVE(ret_value); } @@ -620,37 +603,35 @@ static void H5FDstream_read_from_socket (H5FD_stream_t *stream, * *------------------------------------------------------------------------- */ -static H5FD_t *H5FD_stream_open (const char *filename, - unsigned flags, - hid_t fapl_id, - haddr_t maxaddr) +static H5FD_t * +H5FD_stream_open (const char *filename, + unsigned flags, + hid_t fapl_id, + haddr_t maxaddr) { - H5FD_stream_t _stream, *stream; + H5FD_stream_t *stream=NULL; const H5FD_stream_fapl_t *fapl; int o_flags; - H5E_major_t major; - H5E_minor_t minor; - const char *errormsg; #ifdef WIN32 WSADATA wsadata; #endif - H5P_genplist_t *plist; /* Property list pointer */ - + H5P_genplist_t *plist; /* Property list pointer */ + H5FD_t *ret_value=NULL; /* Function return value */ FUNC_ENTER (H5FD_stream_open, NULL); /* Check arguments */ if (filename == NULL|| *filename == '\0') { - HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, NULL,"invalid file name"); + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, NULL,"invalid file name"); } if (maxaddr == 0 || HADDR_UNDEF == maxaddr) { - HRETURN_ERROR (H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); + HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); } if (ADDR_OVERFLOW (maxaddr)) { - HRETURN_ERROR (H5E_ARGS, H5E_OVERFLOW, NULL, "maxaddr overflow"); + HGOTO_ERROR (H5E_ARGS, H5E_OVERFLOW, NULL, "maxaddr overflow"); } /* Build the open flags */ @@ -661,15 +642,13 @@ static H5FD_t *H5FD_stream_open (const char *filename, if ((O_RDWR & o_flags) && ! (O_CREAT & o_flags)) { - HRETURN_ERROR (H5E_ARGS, H5E_UNSUPPORTED, NULL, - "open stream for read/write not supported"); + HGOTO_ERROR (H5E_ARGS, H5E_UNSUPPORTED, NULL, "open stream for read/write not supported"); } #ifdef WIN32 if (WSAStartup (MAKEWORD (2, 0), &wsadata)) { - HRETURN_ERROR (H5E_IO, H5E_CANTINIT, NULL, - "Couldn't start Win32 socket layer"); + HGOTO_ERROR (H5E_IO, H5E_CANTINIT, NULL, "Couldn't start Win32 socket layer"); } #endif @@ -677,7 +656,7 @@ static H5FD_t *H5FD_stream_open (const char *filename, if (H5P_DEFAULT != fapl_id) { if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id))) - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); fapl = H5P_get_driver_info (plist); } if (fapl == NULL) @@ -685,11 +664,14 @@ static H5FD_t *H5FD_stream_open (const char *filename, fapl = &default_fapl; } - /* zero out file structure and set file access property list */ - HDmemset (&_stream, 0, sizeof (_stream)); - _stream.fapl = *fapl; - - errormsg = NULL; + /* Create the new file struct */ + stream = (H5FD_stream_t *) H5MM_calloc (sizeof (H5FD_stream_t)); + if (stream == NULL) + { + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct"); + } + stream->fapl = *fapl; + stream->socket = H5FD_STREAM_INVALID_SOCKET; /* if an external socket is provided with the file access property list we use that, otherwise the filename argument is parsed and a socket @@ -698,102 +680,80 @@ static H5FD_t *H5FD_stream_open (const char *filename, { if (! H5FD_STREAM_ERROR_CHECK (fapl->socket)) { - _stream.internal_socket = FALSE; - _stream.socket = fapl->socket; + stream->internal_socket = FALSE; + stream->socket = fapl->socket; } else { - _stream.internal_socket = TRUE; - _stream.socket = H5FDstream_open_socket (filename, o_flags, &_stream.fapl, - &errormsg, &major, &minor); - if (_stream.socket != H5FD_STREAM_INVALID_SOCKET) + stream->internal_socket = TRUE; + stream->socket = H5FD_stream_open_socket (filename, o_flags, &stream->fapl); + if (stream->socket != H5FD_STREAM_INVALID_SOCKET) { /* update the port ID in the file access property so that it can be queried via H5P_get_fapl_stream() later on */ - H5P_set_driver (plist, H5FD_STREAM, &_stream.fapl); + H5P_set_driver (plist, H5FD_STREAM, &stream->fapl); } + else + HGOTO_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL, "can't open internal socket"); } } - else - { - _stream.socket = H5FD_STREAM_INVALID_SOCKET; - } /* read the data from socket into memory */ if (O_RDONLY == o_flags) { - if (errormsg == NULL && fapl->do_socket_io) + if (fapl->do_socket_io) { #ifdef DEBUG fprintf (stderr, "Stream VFD: reading file from socket\n"); #endif - H5FDstream_read_from_socket (&_stream, &errormsg, &major, &minor); + if(H5FD_stream_read_from_socket (stream)<0) + HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "can't read file from socket"); } /* Now call the user's broadcast routine if given */ if (fapl->broadcast_fn) { - if ((fapl->broadcast_fn) (&_stream.mem, &_stream.eof, + if ((fapl->broadcast_fn) (&stream->mem, &stream->eof, fapl->broadcast_arg) < 0) { - /* don't override previous error codes */ - if (errormsg == NULL) - { - major = H5E_IO; minor = H5E_READERROR; - errormsg = "broadcast error"; - } + HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "broadcast error"); } /* check for filesize of zero bytes */ - if (errormsg == NULL && _stream.eof == 0) + if (stream->eof == 0) { - major = H5E_IO; minor = H5E_READERROR; - errormsg = "zero filesize"; + HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "zero filesize"); } } /* For files which are read from a socket: the opened socket is not needed anymore */ - if (errormsg == NULL) - { - if (_stream.internal_socket && ! H5FD_STREAM_ERROR_CHECK (_stream.socket)) + if (stream->internal_socket && ! H5FD_STREAM_ERROR_CHECK (stream->socket)) { - H5FD_STREAM_CLOSE_SOCKET (_stream.socket); + H5FD_STREAM_CLOSE_SOCKET (stream->socket); } - _stream.socket = H5FD_STREAM_INVALID_SOCKET; - } + stream->socket = H5FD_STREAM_INVALID_SOCKET; } - /* Create the new file struct */ - stream = NULL; - if (errormsg == NULL) - { - stream = (H5FD_stream_t *) H5MM_calloc (sizeof (H5FD_stream_t)); - if (stream == NULL) - { - major = H5E_RESOURCE; minor = H5E_NOSPACE; - errormsg = "unable to allocate file struct"; - } - else - { - *stream = _stream; - } - } - - if (errormsg) - { - if (_stream.mem) - { - H5MM_xfree (_stream.mem); - } - if (_stream.internal_socket && ! H5FD_STREAM_ERROR_CHECK (_stream.socket)) - { - H5FD_STREAM_CLOSE_SOCKET (_stream.socket); + /* Set return value on success */ + ret_value=(H5FD_t*)stream; + +done: + if(ret_value==NULL) { + if(stream!=NULL) { + if (stream->mem) + { + H5MM_xfree (stream->mem); + } + if (stream->internal_socket && ! H5FD_STREAM_ERROR_CHECK (stream->socket)) + { + H5FD_STREAM_CLOSE_SOCKET (stream->socket); + } + H5MM_xfree(stream); + } /* end if */ } - HRETURN_ERROR (major, minor, NULL, errormsg); - } - FUNC_LEAVE ((H5FD_t *) stream); + FUNC_LEAVE (ret_value); } @@ -813,7 +773,8 @@ static H5FD_t *H5FD_stream_open (const char *filename, * *------------------------------------------------------------------------- */ -static herr_t H5FD_stream_flush (H5FD_t *_stream, unsigned UNUSED closing) +static herr_t +H5FD_stream_flush (H5FD_t *_stream, unsigned UNUSED closing) { H5FD_stream_t *stream = (H5FD_stream_t *) _stream; size_t size; @@ -824,7 +785,6 @@ static herr_t H5FD_stream_flush (H5FD_t *_stream, unsigned UNUSED closing) socklen_t fromlen; H5FD_STREAM_SOCKET_TYPE sock; - FUNC_ENTER (H5FD_stream_flush, FAIL); /* Write to backing store */ @@ -890,11 +850,11 @@ static herr_t H5FD_stream_flush (H5FD_t *_stream, unsigned UNUSED closing) * *------------------------------------------------------------------------- */ -static herr_t H5FD_stream_close (H5FD_t *_stream) +static herr_t +H5FD_stream_close (H5FD_t *_stream) { H5FD_stream_t *stream = (H5FD_stream_t *) _stream; - FUNC_ENTER (H5FD_stream_close, FAIL); /* Flush */ @@ -970,11 +930,11 @@ H5FD_stream_query(const H5FD_t * UNUSED _f, * *------------------------------------------------------------------------- */ -static haddr_t H5FD_stream_get_eoa (H5FD_t *_stream) +static haddr_t +H5FD_stream_get_eoa (H5FD_t *_stream) { H5FD_stream_t *stream = (H5FD_stream_t *) _stream; - FUNC_ENTER (H5FD_stream_get_eoa, HADDR_UNDEF); FUNC_LEAVE (stream->eoa); @@ -998,12 +958,11 @@ static haddr_t H5FD_stream_get_eoa (H5FD_t *_stream) * *------------------------------------------------------------------------- */ -static herr_t H5FD_stream_set_eoa (H5FD_t *_stream, - haddr_t addr) +static herr_t +H5FD_stream_set_eoa (H5FD_t *_stream, haddr_t addr) { H5FD_stream_t *stream = (H5FD_stream_t *) _stream; - FUNC_ENTER (H5FD_stream_set_eoa, FAIL); if (ADDR_OVERFLOW (addr)) @@ -1036,7 +995,8 @@ static herr_t H5FD_stream_set_eoa (H5FD_t *_stream, * *------------------------------------------------------------------------- */ -static haddr_t H5FD_stream_get_eof (H5FD_t *_stream) +static haddr_t +H5FD_stream_get_eof (H5FD_t *_stream) { H5FD_stream_t *stream = (H5FD_stream_t *) _stream; @@ -1065,12 +1025,13 @@ static haddr_t H5FD_stream_get_eof (H5FD_t *_stream) * *------------------------------------------------------------------------- */ -static herr_t H5FD_stream_read (H5FD_t *_stream, - H5FD_mem_t UNUSED type, - hid_t UNUSED dxpl_id, - haddr_t addr, - size_t size, - void *buf /*out*/) +static herr_t +H5FD_stream_read (H5FD_t *_stream, + H5FD_mem_t UNUSED type, + hid_t UNUSED dxpl_id, + haddr_t addr, + size_t size, + void *buf /*out*/) { H5FD_stream_t *stream = (H5FD_stream_t *) _stream; size_t nbytes; @@ -1131,12 +1092,13 @@ static herr_t H5FD_stream_read (H5FD_t *_stream, * *------------------------------------------------------------------------- */ -static herr_t H5FD_stream_write (H5FD_t *_stream, - H5FD_mem_t UNUSED type, - hid_t UNUSED dxpl_id, - haddr_t addr, - size_t size, - const void *buf) +static herr_t +H5FD_stream_write (H5FD_t *_stream, + H5FD_mem_t UNUSED type, + hid_t UNUSED dxpl_id, + haddr_t addr, + size_t size, + const void *buf) { H5FD_stream_t *stream = (H5FD_stream_t *) _stream; @@ -166,7 +166,7 @@ H5FL_reg_init(H5FL_reg_head_t *head) H5FL_reg_gc_node_t *new_node; /* Pointer to the node for the new list to garbage collect */ herr_t ret_value=SUCCEED; /* return value*/ - FUNC_ENTER (H5FL_reg_init, FAIL); + FUNC_ENTER_NOINIT(H5FL_reg_init); /* Allocate a new garbage collection node */ if (NULL==(new_node = H5MM_malloc(sizeof(H5FL_reg_gc_node_t)))) @@ -349,7 +349,7 @@ H5FL_reg_gc_list(H5FL_reg_head_t *head) void *tmp; /* Temporary node pointer */ size_t total_mem; /* Total memory used on list */ - /* FUNC_ENTER_INIT() should not be called, it causes an infinite loop at library termination */ + FUNC_ENTER_NOINIT(H5FL_reg_gc_list); /* Calculate the total memory used on this list */ total_mem=head->onlist*head->size; @@ -380,7 +380,7 @@ H5FL_reg_gc_list(H5FL_reg_head_t *head) /* Decrement global count of free memory on "regular" lists */ H5FL_reg_gc_head.mem_freed-=total_mem; - return(SUCCEED); + FUNC_LEAVE(SUCCEED); } /* end H5FL_reg_gc_list() */ @@ -406,7 +406,7 @@ H5FL_reg_gc(void) { H5FL_reg_gc_node_t *gc_node; /* Pointer into the list of things to garbage collect */ - /* FUNC_ENTER_INIT() should not be called, it causes an infinite loop at library termination */ + FUNC_ENTER_NOINIT(H5FL_reg_gc); /* Walk through all the free lists, free()'ing the nodes */ gc_node=H5FL_reg_gc_head.first; @@ -421,7 +421,7 @@ H5FL_reg_gc(void) /* Double check that all the memory on the free lists is recycled */ assert(H5FL_reg_gc_head.mem_freed==0); - return(SUCCEED); + FUNC_LEAVE(SUCCEED); } /* end H5FL_reg_gc() */ @@ -456,6 +456,8 @@ H5FL_reg_term(void) H5FL_reg_gc_node_t *left; /* pointer to garbage collection lists with work left */ H5FL_reg_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ + FUNC_ENTER_NOINIT(H5FL_reg_term); + if (interface_initialize_g) { /* Free the nodes on the garbage collection list, keeping nodes with allocations outstanding */ left=NULL; @@ -491,7 +493,7 @@ H5FL_reg_term(void) /* Terminating this layer never affects other layers; rather, other layers affect * the termination of this layer. */ - return(0); + FUNC_LEAVE(0); } /* end H5FL_reg_term() */ @@ -520,7 +522,7 @@ H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size) H5FL_blk_node_t *temp; /* Temp. pointer to node in the native list */ H5FL_blk_node_t *ret_value=NULL; - FUNC_ENTER(H5FL_blk_find_list, NULL); + FUNC_ENTER_NOINIT(H5FL_blk_find_list); /* Find the correct free list */ temp=*head; @@ -574,7 +576,7 @@ H5FL_blk_create_list(H5FL_blk_node_t **head, size_t size) H5FL_blk_node_t *temp; /* Temp. pointer to node in the list */ H5FL_blk_node_t *ret_value=NULL; - FUNC_ENTER(H5FL_blk_create_list, NULL); + FUNC_ENTER_NOINIT(H5FL_blk_create_list); /* Allocate room for the new free list node */ if(NULL==(temp=H5FL_ALLOC(H5FL_blk_node_t,0))) @@ -625,7 +627,7 @@ H5FL_blk_init(H5FL_blk_head_t *head) H5FL_blk_gc_node_t *new_node; /* Pointer to the node for the new list to garbage collect */ herr_t ret_value=SUCCEED; /* return value*/ - FUNC_ENTER (H5FL_blk_init, FAIL); + FUNC_ENTER_NOINIT(H5FL_blk_init); /* Allocate a new garbage collection node */ if (NULL==(new_node = H5MM_malloc(sizeof(H5FL_blk_gc_node_t)))) @@ -887,7 +889,7 @@ H5FL_blk_gc_list(H5FL_blk_head_t *head) void *next; /* Temp. ptr to the free list list node */ void *temp; /* Temp. ptr to the free list page node */ - /* FUNC_ENTER_INIT() should not be called, it causes an infinite loop at library termination */ + FUNC_ENTER_NOINIT(H5FL_blk_gc_list); /* Loop through all the nodes in the block free list queue */ while(head->head!=NULL) { @@ -925,7 +927,7 @@ H5FL_blk_gc_list(H5FL_blk_head_t *head) /* Double check that all the memory on this list is recycled */ assert(head->list_mem==0); - return(SUCCEED); + FUNC_LEAVE(SUCCEED); } /* end H5FL_blk_gc_list() */ @@ -949,7 +951,7 @@ H5FL_blk_gc(void) { H5FL_blk_gc_node_t *gc_node; /* Pointer into the list of things to garbage collect */ - /* FUNC_ENTER_INIT() should not be called, it causes an infinite loop at library termination */ + FUNC_ENTER_NOINIT(H5FL_blk_gc); /* Walk through all the free lists, free()'ing the nodes */ gc_node=H5FL_blk_gc_head.first; @@ -964,7 +966,7 @@ H5FL_blk_gc(void) /* Double check that all the memory on the free lists are recycled */ assert(H5FL_blk_gc_head.mem_freed==0); - return(SUCCEED); + FUNC_LEAVE(SUCCEED); } /* end H5FL_blk_gc() */ @@ -992,6 +994,8 @@ H5FL_blk_term(void) { H5FL_blk_gc_node_t *left; /* pointer to garbage collection lists with work left */ H5FL_blk_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ + + FUNC_ENTER_NOINIT(H5FL_blk_term); /* Free the nodes on the garbage collection list, keeping nodes with allocations outstanding */ left=NULL; @@ -1023,7 +1027,7 @@ printf("H5FL_blk_term: head->name=%s, head->allocated=%d\n", H5FL_blk_gc_head.fi /* Point to the list of nodes left with allocations open, if any */ H5FL_blk_gc_head.first=left; - return (H5FL_blk_gc_head.first!=NULL ? 1 : 0); + FUNC_LEAVE (H5FL_blk_gc_head.first!=NULL ? 1 : 0); } /* end H5FL_blk_term() */ @@ -1049,7 +1053,7 @@ H5FL_arr_init(H5FL_arr_head_t *head) H5FL_gc_arr_node_t *new_node; /* Pointer to the node for the new list to garbage collect */ herr_t ret_value=SUCCEED; /* return value*/ - FUNC_ENTER (H5FL_arr_init, FAIL); + FUNC_ENTER_NOINIT(H5FL_arr_init); /* Allocate a new garbage collection node */ if (NULL==(new_node = H5MM_malloc(sizeof(H5FL_gc_arr_node_t)))) @@ -1351,7 +1355,7 @@ H5FL_arr_gc_list(H5FL_arr_head_t *head) int i; /* Counter for array of free lists */ size_t total_mem; /* Total memory used on list */ - /* FUNC_ENTER_INIT() should not be called, it causes an infinite loop at library termination */ + FUNC_ENTER_NOINIT(H5FL_arr_gc_list); /* Check if the array has a fixed maximum number of elements */ if(head->maxelem>0) { @@ -1395,7 +1399,7 @@ H5FL_arr_gc_list(H5FL_arr_head_t *head) H5FL_blk_gc_list(&(head->u.queue)); } /* end else */ - return(SUCCEED); + FUNC_LEAVE(SUCCEED); } /* end H5FL_arr_gc_list() */ @@ -1419,7 +1423,7 @@ H5FL_arr_gc(void) { H5FL_gc_arr_node_t *gc_arr_node; /* Pointer into the list of things to garbage collect */ - /* FUNC_ENTER_INIT() should not be called, it causes an infinite loop at library termination */ + FUNC_ENTER_NOINIT(H5FL_arr_gc); /* Walk through all the free lists, free()'ing the nodes */ gc_arr_node=H5FL_arr_gc_head.first; @@ -1434,7 +1438,7 @@ H5FL_arr_gc(void) /* Double check that all the memory on the free lists are recycled */ assert(H5FL_arr_gc_head.mem_freed==0); - return(SUCCEED); + FUNC_LEAVE(SUCCEED); } /* end H5FL_arr_gc() */ @@ -1463,6 +1467,8 @@ H5FL_arr_term(void) H5FL_gc_arr_node_t *left; /* pointer to garbage collection lists with work left */ H5FL_gc_arr_node_t *tmp; /* Temporary pointer to a garbage collection node */ + FUNC_ENTER_NOINIT(H5FL_arr_term); + /* Free the nodes on the garbage collection list, keeping nodes with allocations outstanding */ left=NULL; while(H5FL_arr_gc_head.first!=NULL) { @@ -1521,7 +1527,7 @@ printf("H5FL_arr_term: head->name=%s, head->allocated=%d\n", H5FL_arr_gc_head.fi /* Point to the list of nodes left with allocations open, if any */ H5FL_arr_gc_head.first=left; - return (H5FL_arr_gc_head.first!=NULL ? 1 : 0); + FUNC_LEAVE (H5FL_arr_gc_head.first!=NULL ? 1 : 0); } /* end H5FL_arr_term() */ @@ -1543,7 +1549,7 @@ printf("H5FL_arr_term: head->name=%s, head->allocated=%d\n", H5FL_arr_gc_head.fi herr_t H5FL_garbage_coll(void) { - /* FUNC_ENTER_INIT() should not be called, it causes an infinite loop at library termination */ + FUNC_ENTER_NOINIT(H5FL_garbage_coll); /* Garbage collect the free lists for array objects */ H5FL_arr_gc(); @@ -1554,7 +1560,7 @@ H5FL_garbage_coll(void) /* Garbage collect the free lists for regular objects */ H5FL_reg_gc(); - return(SUCCEED); + FUNC_LEAVE(SUCCEED); } /* end H5FL_garbage_coll() */ @@ -1637,11 +1643,13 @@ H5FL_term_interface(void) { int ret_value=0; + FUNC_ENTER_NOINIT(H5FL_term_interface); + /* Garbage collect any nodes on the free lists */ H5FL_garbage_coll(); ret_value=H5FL_reg_term()+H5FL_arr_term()+H5FL_blk_term(); - return(ret_value); + FUNC_LEAVE(ret_value); } diff --git a/src/H5Fistore.c b/src/H5Fistore.c index a0f7497..3b8b7a5 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -317,6 +317,9 @@ H5F_istore_sizeof_rkey(H5F_t UNUSED *f, const void *_udata) const H5F_istore_ud1_t *udata = (const H5F_istore_ud1_t *) _udata; size_t nbytes; + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5F_istore_sizeof_rkey); + assert(udata); assert(udata->mesg.ndims > 0 && udata->mesg.ndims <= H5O_LAYOUT_NDIMS); @@ -324,7 +327,7 @@ H5F_istore_sizeof_rkey(H5F_t UNUSED *f, const void *_udata) 4 + /*filter mask */ udata->mesg.ndims*8; /*dimension indices */ - return nbytes; + FUNC_LEAVE(nbytes); } @@ -863,9 +866,10 @@ H5F_istore_iter_allocated (H5F_t UNUSED *f, void *_lt_key, haddr_t UNUSED addr, H5F_istore_ud1_t *bt_udata = (H5F_istore_ud1_t *)_udata; H5F_istore_key_t *lt_key = (H5F_istore_key_t *)_lt_key; - FUNC_ENTER(H5F_istore_iterate, FAIL); + FUNC_ENTER_NOINIT(H5F_istore_iterate); bt_udata->total_storage += lt_key->nbytes; + FUNC_LEAVE(SUCCEED); } /* H5F_istore_iter_allocated() */ @@ -899,7 +903,7 @@ H5F_istore_iter_dump (H5F_t UNUSED *f, void *_lt_key, haddr_t UNUSED addr, H5F_istore_key_t *lt_key = (H5F_istore_key_t *)_lt_key; unsigned u; - FUNC_ENTER(H5F_istore_iterate, FAIL); + FUNC_ENTER_NOINIT(H5F_istore_iterate); if (bt_udata->stream) { if (0==bt_udata->total_storage) { @@ -985,7 +989,8 @@ H5F_istore_flush_entry(H5F_t *f, H5F_rdcc_ent_t *ent, hbool_t reset) size_t alloc; /*bytes allocated for BUF */ hbool_t point_of_no_return = FALSE; - FUNC_ENTER(H5F_istore_flush_entry, FAIL); + FUNC_ENTER_NOINIT(H5F_istore_flush_entry); + assert(f); assert(ent); assert(!ent->locked); @@ -1103,7 +1108,7 @@ H5F_istore_preempt(H5F_t *f, H5F_rdcc_ent_t * ent, hbool_t flush) { H5F_rdcc_t *rdcc = &(f->shared->rdcc); - FUNC_ENTER(H5F_istore_preempt, FAIL); + FUNC_ENTER_NOINIT(H5F_istore_preempt); assert(f); assert(ent); @@ -1280,7 +1285,7 @@ H5F_istore_prune (H5F_t *f, size_t size) H5F_rdcc_ent_t *p[2], *cur; /*list pointers */ H5F_rdcc_ent_t *n[2]; /*list next pointers */ - FUNC_ENTER (H5F_istore_prune, FAIL); + FUNC_ENTER_NOINIT(H5F_istore_prune); /* * Preemption is accomplished by having multiple pointers (currently two) @@ -1415,7 +1420,7 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, void *ret_value=NULL; /*return value */ H5P_genplist_t *plist=NULL; /* Property list */ - FUNC_ENTER (H5F_istore_lock, NULL); + FUNC_ENTER_NOINIT(H5F_istore_lock); if (rdcc->nslots>0) { /* We don't care about loss of precision in the following statement. */ @@ -1682,7 +1687,7 @@ H5F_istore_unlock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, unsigned u; H5P_genplist_t *plist; /* Property list */ - FUNC_ENTER (H5F_istore_unlock, FAIL); + FUNC_ENTER_NOINIT(H5F_istore_unlock); if (UINT_MAX==*idx_hint) { /*not in cache*/ @@ -2351,7 +2356,7 @@ H5F_istore_get_addr(H5F_t *f, const H5O_layout_t *layout, unsigned u; haddr_t ret_value=HADDR_UNDEF; /* Return value */ - FUNC_ENTER (H5F_istore_get_addr, HADDR_UNDEF); + FUNC_ENTER_NOINIT(H5F_istore_get_addr); assert(f); assert(layout && (layout->ndims > 0)); @@ -2776,7 +2781,7 @@ H5F_istore_prune_extent(H5F_t *f, void *_lt_key, haddr_t UNUSED addr, * storage that contains the beginning of the logical address space represented by UDATA. */ - FUNC_ENTER(H5F_istore_prune_extent, FAIL); + FUNC_ENTER_NOINIT(H5F_istore_prune_extent); /* Figure out what chunks are no longer in use for the specified extent and release them */ for(u = 0; u < bt_udata->mesg.ndims - 1; u++) @@ -2832,10 +2837,13 @@ H5F_istore_remove(H5F_t *f, haddr_t addr, void *_lt_key /*in,out */ , { H5F_istore_key_t *lt_key = (H5F_istore_key_t *)_lt_key; + FUNC_ENTER(H5F_istore_remove,H5B_INS_ERROR); + H5FD_free(f->shared->lf, H5FD_MEM_DRAW, addr, (hsize_t)lt_key->nbytes); *lt_key_changed = FALSE; *rt_key_changed = FALSE; - return H5B_INS_REMOVE; + + FUNC_LEAVE(H5B_INS_REMOVE); } @@ -739,7 +739,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) static herr_t H5G_init_interface(void) { - FUNC_ENTER(H5G_init_interface, FAIL); + FUNC_ENTER_NOINIT(H5G_init_interface); /* Initialize the atom group for the group IDs */ if (H5I_init_group(H5I_GROUP, H5I_GROUPID_HASHSIZE, H5G_RESERVED_ATOMS, @@ -784,6 +784,8 @@ H5G_term_interface(void) { size_t i; int n=0; + + FUNC_ENTER_NOINIT(H5G_term_interface); if (interface_initialize_g) { if ((n=H5I_nmembers(H5I_GROUP))) { @@ -809,7 +811,7 @@ H5G_term_interface(void) } } - return n; + FUNC_LEAVE(n); } @@ -916,11 +918,15 @@ H5G_register_type(int type, htri_t(*isa)(H5G_entry_t*), const char *_desc) static const char * H5G_component(const char *name, size_t *size_p) { + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5G_component); + assert(name); while ('/' == *name) name++; if (size_p) *size_p = HDstrcspn(name, "/"); - return name; + + FUNC_LEAVE(name); } @@ -951,7 +957,7 @@ H5G_basename(const char *name, size_t *size_p) { size_t i; - FUNC_ENTER(H5G_basename, NULL); + FUNC_ENTER_NOINIT(H5G_basename); /* Find the end of the base name */ i = HDstrlen(name); @@ -1060,13 +1066,13 @@ H5G_namei(H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/, int _nlinks = H5G_NLINKS; const char *s = NULL; + FUNC_ENTER_NOINIT(H5G_namei); + if (rest) *rest = name; if (!grp_ent) grp_ent = &_grp_ent; if (!obj_ent) obj_ent = &_obj_ent; if (!nlinks) nlinks = &_nlinks; - FUNC_ENTER(H5G_namei, FAIL); - /* * Where does the searching start? For absolute names it starts at the * root of the file; for relative names it starts at CWG. @@ -1762,7 +1768,10 @@ H5G_find(H5G_entry_t *loc, const char *name, H5G_entry_t * H5G_entof (H5G_t *grp) { - return grp ? &(grp->ent) : NULL; + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5G_entof); + + FUNC_LEAVE(grp ? &(grp->ent) : NULL); } @@ -1785,8 +1794,12 @@ H5G_entof (H5G_t *grp) H5F_t * H5G_fileof (H5G_t *grp) { + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5G_fileof); + assert (grp); - return grp->ent.file; + + FUNC_LEAVE(grp->ent.file); } diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 1c34703..e46be42 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -126,7 +126,10 @@ H5FL_BLK_DEFINE_STATIC(symbol_node); static size_t H5G_node_sizeof_rkey(H5F_t *f, const void UNUSED * udata) { - return H5F_SIZEOF_SIZE(f); /*the name offset */ + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5G_node_sizeof_rkey); + + FUNC_LEAVE(H5F_SIZEOF_SIZE(f)); /*the name offset */ } @@ -214,8 +217,10 @@ H5G_node_encode_key(H5F_t *f, H5B_t UNUSED *bt, uint8_t *raw, void *_key) static size_t H5G_node_size(H5F_t *f) { - return H5G_NODE_SIZEOF_HDR(f) + - (2 * H5G_node_k(f)) * H5G_SIZEOF_ENTRY(f); + FUNC_ENTER_NOINIT(H5G_node_size); + + FUNC_LEAVE(H5G_NODE_SIZEOF_HDR(f) + + (2 * H5G_node_k(f)) * H5G_SIZEOF_ENTRY(f)); } @@ -466,7 +466,7 @@ H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, int cwfsno, size_t size) uint8_t *p = NULL; size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); - FUNC_ENTER (H5HG_alloc, 0); + FUNC_ENTER_NOINIT(H5HG_alloc); /* Check args */ assert (heap); @@ -555,11 +555,14 @@ H5HL_peek(H5F_t *f, haddr_t addr, size_t offset) static H5HL_free_t * H5HL_remove_free(H5HL_t *heap, H5HL_free_t *fl) { + FUNC_ENTER_NOINIT(H5HL_remove_free); + if (fl->prev) fl->prev->next = fl->next; if (fl->next) fl->next->prev = fl->prev; if (!fl->prev) heap->freelist = fl->next; - return H5FL_FREE(H5HL_free_t,fl); + + FUNC_LEAVE(H5FL_FREE(H5HL_free_t,fl)); } /*------------------------------------------------------------------------- @@ -82,7 +82,8 @@ static herr_t H5I_init_interface(void) { herr_t ret_value = SUCCEED; - FUNC_ENTER(H5I_init_interface, FAIL); + + FUNC_ENTER_NOINIT(H5I_init_interface); /* * Make certain the ID types don't overflow the number of bits allocated @@ -119,6 +120,8 @@ H5I_term_interface(void) H5I_type_t grp; int n=0; + FUNC_ENTER_NOINIT(H5I_term_interface); + if (interface_initialize_g) { /* How many groups are still being used? */ for (grp=(H5I_type_t)0; grp<H5I_NGROUPS; H5_INC_ENUM(H5I_type_t,grp)) { @@ -138,7 +141,7 @@ H5I_term_interface(void) /* Mark interface closed */ interface_initialize_g = 0; } - return n; + FUNC_LEAVE(n); } @@ -1014,7 +1017,7 @@ H5I_find_id(hid_t id) int i; #endif - FUNC_ENTER(H5I_find_id, NULL); + FUNC_ENTER_NOINIT(H5I_find_id); /* Check arguments */ grp = H5I_GROUP(id); @@ -50,8 +50,11 @@ static int interface_initialize_g = 0; void * H5MM_realloc(void *mem, size_t size) { + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5MM_realloc); + if (!mem) { - if (0 == size) return NULL; + if (0 == size) HRETURN(NULL); mem = H5MM_malloc(size); } else if (0 == size) { @@ -62,7 +65,7 @@ H5MM_realloc(void *mem, size_t size) assert(mem); } - return mem; + FUNC_LEAVE(mem); } @@ -90,11 +93,15 @@ H5MM_xstrdup(const char *s) { char *mem; - if (!s) return NULL; + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5MM_xstrdup); + + if (!s) HRETURN(NULL); mem = H5MM_malloc(HDstrlen(s) + 1); assert (mem); HDstrcpy(mem, s); - return mem; + + FUNC_LEAVE(mem); } @@ -162,6 +169,10 @@ H5MM_strdup(const char *s) void * H5MM_xfree(void *mem) { + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5MM_xfree); + if (mem) HDfree(mem); - return NULL; + + FUNC_LEAVE(NULL); } diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h index b37a4a3..0f1a597 100644 --- a/src/H5MMprivate.h +++ b/src/H5MMprivate.h @@ -29,6 +29,7 @@ #define H5MM_malloc(Z) HDmalloc(MAX(1,Z)) #define H5MM_calloc(Z) HDcalloc(1,MAX(1,Z)) #endif /* H5_MALLOC_WORKS */ +#define H5MM_free(Z) HDfree(1,Z) /* * Library prototypes... @@ -117,7 +117,7 @@ H5FL_EXTERN(time_t); static herr_t H5O_init_interface(void) { - FUNC_ENTER(H5O_init_interface, FAIL); + FUNC_ENTER_NOINIT(H5O_init_interface); /* * Initialize functions that decode messages from symbol table entries. @@ -1148,7 +1148,7 @@ H5O_find_in_ohdr(H5F_t *f, haddr_t addr, const H5O_class_t **type_p, unsigned u; const H5O_class_t *type = NULL; - FUNC_ENTER(H5O_find_in_ohdr, UFAIL); + FUNC_ENTER_NOINIT(H5O_find_in_ohdr); /* Check args */ assert(f); @@ -1411,7 +1411,7 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force) time_t now = HDtime(NULL); size_t size; - FUNC_ENTER(H5O_touch_oh, FAIL); + FUNC_ENTER_NOINIT(H5O_touch_oh); assert(oh); /* Look for existing message */ @@ -1657,7 +1657,7 @@ H5O_alloc_extend_chunk(H5O_t *oh, unsigned chunkno, size_t size) size_t aligned_size = H5O_ALIGN(size); uint8_t *old_addr; - FUNC_ENTER(H5O_alloc_extend_chunk, UFAIL); + FUNC_ENTER_NOINIT(H5O_alloc_extend_chunk); /* check args */ assert(oh); @@ -1793,7 +1793,7 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size) int chunkno; unsigned u; - FUNC_ENTER(H5O_alloc_new_chunk, UFAIL); + FUNC_ENTER_NOINIT(H5O_alloc_new_chunk); /* check args */ assert (oh); @@ -1978,7 +1978,7 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size) unsigned null_idx; size_t aligned_size = H5O_ALIGN(size); - FUNC_ENTER(H5O_alloc, UFAIL); + FUNC_ENTER_NOINIT(H5O_alloc); /* check args */ assert (oh); diff --git a/src/H5Odtype.c b/src/H5Odtype.c index ed94cd4..8adfc8b 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -93,7 +93,7 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt) int i, j; size_t z; - FUNC_ENTER(H5O_dtype_decode_helper, FAIL); + FUNC_ENTER_NOINIT(H5O_dtype_decode_helper); /* check args */ assert(pp && *pp); @@ -445,7 +445,7 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) int i, j; size_t n, z, aligned; - FUNC_ENTER(H5O_dtype_encode_helper, FAIL); + FUNC_ENTER_NOINIT(H5O_dtype_encode_helper); /* check args */ assert(pp && *pp); @@ -114,6 +114,9 @@ H5P_xor_name(const char *s) unsigned ret=0; unsigned char temp; + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5P_xor_name); + if(s!=NULL) while(*s!='\0') { temp=(ret>>24)&0xff; @@ -122,7 +125,7 @@ H5P_xor_name(const char *s) ret ^= *s++; } - return(ret); + FUNC_LEAVE(ret); } /* end H5P_xor_name() */ /*-------------------------------------------------------------------------- @@ -140,7 +143,10 @@ DESCRIPTION static unsigned H5P_hash_name(const char *s, unsigned hashsize) { - return(H5P_xor_name(s)%hashsize); + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5P_hash_name); + + FUNC_LEAVE(H5P_xor_name(s)%hashsize); } /* end H5P_hash_name() */ /*-------------------------------------------------------------------------- @@ -162,7 +168,7 @@ H5P_init_interface(void) H5P_genclass_t *pclass; /* Pointer to property list class to create */ herr_t ret_value = SUCCEED; - FUNC_ENTER(H5P_init_interface, FAIL); + FUNC_ENTER_NOINIT(H5P_init_interface); /* Make certain IDs are initialized */ if (ret_value < 0) @@ -263,6 +269,8 @@ H5P_term_interface(void) int nclass=0; int n=0; + FUNC_ENTER_NOINIT(H5P_term_interface); + if (interface_initialize_g) { /* Destroy HDF5 library property classes & lists */ @@ -311,7 +319,7 @@ H5P_term_interface(void) interface_initialize_g = 0; } } - return n; + FUNC_LEAVE(n); } @@ -335,7 +343,8 @@ H5P_term_interface(void) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static hid_t H5P_copy_pclass(H5P_genclass_t *pclass) +static hid_t +H5P_copy_pclass(H5P_genclass_t *pclass) { H5P_genclass_t *new_pclass = NULL; /* Property list class copied */ H5P_genprop_t *tmp; /* Temporary pointer to parent class properties */ @@ -343,7 +352,7 @@ static hid_t H5P_copy_pclass(H5P_genclass_t *pclass) unsigned u; /* Local index variable */ hid_t ret_value=FAIL; /* return value */ - FUNC_ENTER (H5P_copy_pclass, FAIL); + FUNC_ENTER_NOINIT(H5P_copy_pclass); assert(pclass); @@ -4515,7 +4524,7 @@ H5P_dup_prop(H5P_genprop_t *oprop) H5P_genprop_t *prop=NULL; /* Pointer to new property copied */ H5P_genprop_t *ret_value=NULL; /* Return value */ - FUNC_ENTER (H5P_dup_prop, NULL); + FUNC_ENTER_NOINIT(H5P_dup_prop); assert(oprop); @@ -4608,7 +4617,7 @@ H5P_create_prop(const char *name, size_t size, void *def_value, void *value, H5P_genprop_t *prop=NULL; /* Pointer to new property copied */ H5P_genprop_t *ret_value=NULL; /* Return value */ - FUNC_ENTER (H5P_create_prop, NULL); + FUNC_ENTER_NOINIT(H5P_create_prop); assert(name); assert((size>0 && (def_value!=NULL || value!=NULL)) || (size==0)); @@ -4698,7 +4707,7 @@ H5P_add_prop(H5P_genprop_t *hash[], unsigned hashsize, H5P_genprop_t *prop) unsigned loc; /* Hash table location */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER (H5P_add_prop, FAIL); + FUNC_ENTER_NOINIT(H5P_add_prop); assert(hash); assert(hashsize>0); @@ -4744,7 +4753,7 @@ H5P_find_prop(H5P_genprop_t *hash[], unsigned hashsize, const char *name) unsigned loc; /* Hash table location */ unsigned xor_val; /* XOR'ed value of the name to look for */ - FUNC_ENTER (H5P_find_prop, NULL); + FUNC_ENTER_NOINIT(H5P_find_prop); assert(hash); assert(hashsize>0); @@ -4794,7 +4803,7 @@ H5P_free_prop(H5P_genprop_t *prop) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER (H5P_free_prop, FAIL); + FUNC_ENTER_NOINIT(H5P_free_prop); assert(prop); @@ -4842,7 +4851,7 @@ H5P_free_all_prop(H5P_genprop_t *hash[], unsigned hashsize, unsigned make_cb) unsigned u; /* Local index variable */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER (H5P_free_all_prop, FAIL); + FUNC_ENTER_NOINIT(H5P_free_all_prop); assert(hash); assert(hashsize>0); @@ -4899,7 +4908,7 @@ H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER (H5P_access_class, FAIL); + FUNC_ENTER_NOINIT(H5P_access_class); assert(pclass); assert(mod>H5P_MOD_ERR && mod<H5P_MOD_MAX); @@ -4999,7 +5008,7 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, unsigned hashsize, H5P_genclass_t *pclass; /* Property list class created */ H5P_genclass_t *ret_value=NULL; /* return value */ - FUNC_ENTER (H5P_create_class, NULL); + FUNC_ENTER_NOINIT(H5P_create_class); assert(name); /* Allow internal classes to break some rules */ @@ -5170,7 +5179,7 @@ static H5P_genplist_t *H5P_create(H5P_genclass_t *pclass) H5P_genprop_t *pcopy; /* Copy of property to insert into class */ unsigned u; /* Local index variable */ - FUNC_ENTER (H5P_create, NULL); + FUNC_ENTER_NOINIT(H5P_create); assert(pclass); @@ -5852,7 +5861,8 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, +static herr_t +H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close) @@ -5860,7 +5870,7 @@ static herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, H5P_genprop_t *new_prop=NULL; /* Temporary property pointer */ herr_t ret_value=FAIL; /* return value */ - FUNC_ENTER (H5P_insert, FAIL); + FUNC_ENTER_NOINIT(H5P_insert); assert(plist); assert(name); @@ -6189,11 +6199,12 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static htri_t H5P_exist_plist(H5P_genplist_t *plist, const char *name) +static htri_t +H5P_exist_plist(H5P_genplist_t *plist, const char *name) { htri_t ret_value=FAIL; /* return value */ - FUNC_ENTER (H5P_exist_plist, FAIL); + FUNC_ENTER_NOINIT(H5P_exist_plist); assert(plist); assert(name); @@ -6229,11 +6240,12 @@ static htri_t H5P_exist_plist(H5P_genplist_t *plist, const char *name) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static htri_t H5P_exist_pclass(H5P_genclass_t *pclass, const char *name) +static htri_t +H5P_exist_pclass(H5P_genclass_t *pclass, const char *name) { htri_t ret_value=FAIL; /* return value */ - FUNC_ENTER (H5P_exist_pclass, FAIL); + FUNC_ENTER_NOINIT(H5P_exist_pclass); assert(pclass); assert(name); @@ -6328,12 +6340,13 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static herr_t H5P_get_size_plist(H5P_genplist_t *plist, const char *name, size_t *size) +static herr_t +H5P_get_size_plist(H5P_genplist_t *plist, const char *name, size_t *size) { H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER (H5P_get_size_plist, FAIL); + FUNC_ENTER_NOINIT(H5P_get_size_plist); assert(plist); assert(name); @@ -6373,12 +6386,13 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static herr_t H5P_get_size_pclass(H5P_genclass_t *pclass, const char *name, size_t *size) +static herr_t +H5P_get_size_pclass(H5P_genclass_t *pclass, const char *name, size_t *size) { H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER (H5P_get_size_pclass, FAIL); + FUNC_ENTER_NOINIT(H5P_get_size_pclass); assert(pclass); assert(name); @@ -6479,11 +6493,12 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static H5P_genclass_t *H5P_get_class(H5P_genplist_t *plist) +static H5P_genclass_t * +H5P_get_class(H5P_genplist_t *plist) { H5P_genclass_t *ret_value=NULL; /* return value */ - FUNC_ENTER (H5P_get_class, NULL); + FUNC_ENTER_NOINIT(H5P_get_class); assert(plist); @@ -6566,11 +6581,12 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static herr_t H5P_get_nprops_plist(H5P_genplist_t *plist, size_t *nprops) +static herr_t +H5P_get_nprops_plist(H5P_genplist_t *plist, size_t *nprops) { herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER (H5P_get_nprops_plist, FAIL); + FUNC_ENTER_NOINIT(H5P_get_nprops_plist); assert(plist); assert(nprops); @@ -6698,12 +6714,13 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static int H5P_cmp_prop(H5P_genprop_t *prop1, H5P_genprop_t *prop2) +static int +H5P_cmp_prop(H5P_genprop_t *prop1, H5P_genprop_t *prop2) { int cmp_value; /* Value from comparison */ int ret_value=0; /* return value */ - FUNC_ENTER (H5P_cmp_prop, FAIL); + FUNC_ENTER_NOINIT(H5P_cmp_prop); assert(prop1); assert(prop2); @@ -6789,14 +6806,15 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static int H5P_cmp_class(H5P_genclass_t *pclass1, H5P_genclass_t *pclass2) +static int +H5P_cmp_class(H5P_genclass_t *pclass1, H5P_genclass_t *pclass2) { H5P_genprop_t *tprop1, *tprop2;/* Temporary pointer to properties */ unsigned u; /* Local index variable */ int cmp_value; /* Value from comparison */ int ret_value=0; /* return value */ - FUNC_ENTER (H5P_cmp_class, FAIL); + FUNC_ENTER_NOINIT(H5P_cmp_class); assert(pclass1); assert(pclass2); @@ -6899,14 +6917,15 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static int H5P_cmp_plist(H5P_genplist_t *plist1, H5P_genplist_t *plist2) +static int +H5P_cmp_plist(H5P_genplist_t *plist1, H5P_genplist_t *plist2) { H5P_genprop_t *tprop1, *tprop2;/* Temporary pointer to properties */ unsigned u; /* Local index variable */ int cmp_value; /* Value from comparison */ int ret_value=0; /* return value */ - FUNC_ENTER (H5P_cmp_plist, FAIL); + FUNC_ENTER_NOINIT(H5P_cmp_plist); assert(plist1); assert(plist2); @@ -7028,11 +7047,12 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static htri_t H5P_isa_class_real(H5P_genclass_t *pclass1, H5P_genclass_t *pclass2) +static htri_t +H5P_isa_class_real(H5P_genclass_t *pclass1, H5P_genclass_t *pclass2) { htri_t ret_value=FAIL; - FUNC_ENTER (H5P_isa_class_real, FAIL); + FUNC_ENTER_NOINIT(H5P_isa_class_real); assert(pclass1); assert(pclass2); @@ -7201,14 +7221,15 @@ iteration, the function's behavior is undefined. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static int H5P_iterate_props(hid_t id, H5P_genprop_t *hash[], unsigned hashsize, int *idx, H5P_iterate_t iter_func, void *iter_data) +static int +H5P_iterate_props(hid_t id, H5P_genprop_t *hash[], unsigned hashsize, int *idx, H5P_iterate_t iter_func, void *iter_data) { H5P_genprop_t *prop; /* Temporary property pointer */ unsigned u; /* Local index variable */ int curr_idx=0; /* Current iteration index */ int ret_value=0; /* Return value */ - FUNC_ENTER (H5P_iterate_props, FAIL); + FUNC_ENTER_NOINIT(H5P_iterate_props); assert(hash); assert(hashsize>0); @@ -7292,12 +7313,13 @@ iteration, the function's behavior is undefined. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static int H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_t iter_func, void *iter_data) +static int +H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_t iter_func, void *iter_data) { H5P_genplist_t *plist; /* Property list pointer */ int ret_value=0; /* Return value */ - FUNC_ENTER (H5P_iterate_plist, FAIL); + FUNC_ENTER_NOINIT(H5P_iterate_plist); assert(idx); assert(iter_func); @@ -7365,12 +7387,13 @@ iteration, the function's behavior is undefined. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static int H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_t iter_func, void *iter_data) +static int +H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_t iter_func, void *iter_data) { H5P_genclass_t *pclass; /* Property list pointer */ int ret_value=0; /* Return value */ - FUNC_ENTER (H5P_iterate_pclass, FAIL); + FUNC_ENTER_NOINIT(H5P_iterate_pclass); assert(idx); assert(iter_func); @@ -7842,14 +7865,15 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static herr_t H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name) +static herr_t +H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name) { H5P_genprop_t *prop; /* Temporary property pointer */ H5P_genprop_t *tprop, *prev;/* Temporary pointer to properties */ unsigned loc; /* Hash table location */ herr_t ret_value=FAIL; /* return value */ - FUNC_ENTER (H5P_remove, FAIL); + FUNC_ENTER_NOINIT(H5P_remove); assert(plist); assert(name); @@ -7998,7 +8022,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) H5P_genprop_t *new_prop=NULL; /* Pointer to new property */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER (H5P_copy_prop_plist, FAIL); + FUNC_ENTER_NOINIT(H5P_copy_prop_plist); assert(name); @@ -8105,7 +8129,7 @@ H5P_copy_prop_pclass(H5P_genclass_t *dst_pclass, H5P_genclass_t UNUSED *src_pcla H5P_genprop_t *prop; /* Temporary property pointer */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER (H5P_copy_prop_pclass, FAIL); + FUNC_ENTER_NOINIT(H5P_copy_prop_pclass); assert(dst_pclass); assert(src_pclass); @@ -8227,14 +8251,15 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name) +static herr_t +H5P_unregister(H5P_genclass_t *pclass, const char *name) { H5P_genprop_t *prop; /* Temporary property pointer */ H5P_genprop_t *tprop, *prev;/* Temporary pointer to properties */ unsigned loc; /* Hash table location */ herr_t ret_value=FAIL; /* return value */ - FUNC_ENTER (H5P_unregister, FAIL); + FUNC_ENTER_NOINIT(H5P_unregister); assert(pclass); assert(name); @@ -8354,12 +8379,13 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static herr_t H5P_close(void *_plist) +static herr_t +H5P_close(void *_plist) { H5P_genplist_t *plist=(H5P_genplist_t *)_plist; herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER (H5P_close, FAIL); + FUNC_ENTER_NOINIT(H5P_close); assert(plist); @@ -8526,11 +8552,12 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static H5P_genclass_t *H5P_get_class_parent(H5P_genclass_t *pclass) +static H5P_genclass_t * +H5P_get_class_parent(H5P_genclass_t *pclass) { H5P_genclass_t *ret_value=NULL; /* return value */ - FUNC_ENTER (H5P_get_class_parent, NULL); + FUNC_ENTER_NOINIT(H5P_get_class_parent); assert(pclass); @@ -8609,12 +8636,13 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static herr_t H5P_close_class(void *_pclass) +static herr_t +H5P_close_class(void *_pclass) { H5P_genclass_t *pclass=(H5P_genclass_t *)_pclass; herr_t ret_value = FAIL; /* return value */ - FUNC_ENTER (H5P_close_class, FAIL); + FUNC_ENTER_NOINIT(H5P_close_class); assert(pclass); @@ -55,7 +55,7 @@ DESCRIPTION static herr_t H5R_init_interface(void) { - FUNC_ENTER(H5R_init_interface, FAIL); + FUNC_ENTER_NOINIT(H5R_init_interface); /* Initialize the atom group for the file IDs */ if (H5I_init_group(H5I_REFERENCE, H5I_REFID_HASHSIZE, H5R_RESERVED_ATOMS, @@ -89,6 +89,8 @@ int H5R_term_interface(void) { int n=0; + + FUNC_ENTER_NOINIT(H5R_term_interface); if (interface_initialize_g) { if ((n=H5I_nmembers(H5I_REFERENCE))) { @@ -100,7 +102,7 @@ H5R_term_interface(void) } } - return n; + FUNC_LEAVE(n); } @@ -137,7 +139,7 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type, H5G_stat_t sb; /* Stat buffer for retrieving OID */ herr_t ret_value = FAIL; - FUNC_ENTER(H5R_create, FAIL); + FUNC_ENTER_NOINIT(H5R_create); assert(_ref); assert(loc); @@ -341,7 +343,7 @@ H5R_dereference(H5F_t *file, H5R_type_t ref_type, void *_ref) int oid_type; /* type of object being dereferenced */ hid_t ret_value = FAIL; - FUNC_ENTER(H5R_dereference, FAIL); + FUNC_ENTER_NOINIT(H5R_dereference); assert(_ref); assert(ref_type>H5R_BADTYPE || ref_type<H5R_MAXTYPE); @@ -544,7 +546,7 @@ H5R_get_region(H5F_t *file, H5R_type_t UNUSED ref_type, void *_ref) uint8_t *buf; /* Buffer to store serialized selection in */ H5S_t *ret_value = NULL; - FUNC_ENTER(H5R_get_region, NULL); + FUNC_ENTER_NOINIT(H5R_get_region); assert(_ref); assert(ref_type==H5R_DATASET_REGION); @@ -685,7 +687,7 @@ H5R_get_object_type(H5F_t *file, void *_ref) uint8_t *p; /* Pointer to OID to store */ int ret_value = H5G_UNKNOWN; - FUNC_ENTER(H5R_get_object_type, H5G_UNKNOWN); + FUNC_ENTER_NOINIT(H5R_get_object_type); assert(ref); assert(file); @@ -791,7 +793,7 @@ H5R_get_obj_type(H5F_t *file, H5R_type_t ref_type, void *_ref) uint8_t *p; /* Pointer to OID to store */ int ret_value = H5G_UNKNOWN; - FUNC_ENTER(H5R_get_obj_type, H5G_UNKNOWN); + FUNC_ENTER_NOINIT(H5R_get_obj_type); assert(file); assert(_ref); @@ -73,7 +73,7 @@ DESCRIPTION static herr_t H5S_init_interface(void) { - FUNC_ENTER(H5S_init_interface, FAIL); + FUNC_ENTER_NOINIT(H5S_init_interface); /* Initialize the atom group for the file IDs */ if (H5I_init_group(H5I_DATASPACE, H5I_DATASPACEID_HASHSIZE, @@ -133,6 +133,8 @@ H5S_term_interface(void) char buf[256]; #endif + FUNC_ENTER_NOINIT(H5S_term_interface); + if (interface_initialize_g) { if ((n=H5I_nmembers(H5I_DATASPACE))) { H5I_clear_group(H5I_DATASPACE, FALSE); @@ -270,7 +272,7 @@ H5S_term_interface(void) } } - return n; + FUNC_LEAVE(n); } diff --git a/src/H5Shyper.c b/src/H5Shyper.c index fda1b07..5130343 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -104,7 +104,7 @@ H5S_hyper_print_spans_helper(struct H5S_hyper_span_t *span,unsigned depth) { struct H5S_hyper_span_t *tmp_span; - FUNC_ENTER(H5S_hyper_print_spans_helper, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_print_spans_helper); tmp_span=span; while(tmp_span) { @@ -122,7 +122,7 @@ H5S_hyper_print_spans_helper(struct H5S_hyper_span_t *span,unsigned depth) static herr_t H5S_hyper_print_spans(const struct H5S_hyper_span_info_t *span_lst) { - FUNC_ENTER(H5S_hyper_print_spans, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_print_spans); if(span_lst!=NULL) { printf("%s: spans=%p, count=%u, scratch=%p, head=%p\n",FUNC,span_lst,span_lst->count,span_lst->scratch,span_lst->head); @@ -305,7 +305,7 @@ H5S_hyper_iter_next (const H5S_t *file_space, H5S_sel_iter_t *file_iter) unsigned i; /* Counters */ unsigned ndims; /* Number of dimensions of dataset */ - FUNC_ENTER (H5S_hyper_iter_next, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_iter_next); /* Set some useful rank information */ fast_dim=file_space->extent.u.simple.rank-1; @@ -413,7 +413,7 @@ H5S_hyper_fread (H5F_t *f, const struct H5O_layout_t *layout, H5P_genplist_t *plist; /* Property list */ hssize_t ret_value=FAIL; - FUNC_ENTER (H5S_hyper_fread, 0); + FUNC_ENTER_NOINIT(H5S_hyper_fread); /* Check args */ assert(f); @@ -870,7 +870,7 @@ H5S_hyper_fread_opt (H5F_t *f, const struct H5O_layout_t *layout, H5P_genplist_t *plist; /* Property list */ hsize_t ret_value=0; /* Return value */ - FUNC_ENTER (H5S_hyper_fread_opt, 0); + FUNC_ENTER_NOINIT(H5S_hyper_fread_opt); /* Get the hyperslab vector size */ if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER) || NULL == (plist = H5I_object(dxpl_id))) @@ -1438,7 +1438,7 @@ H5S_hyper_fwrite (H5F_t *f, const struct H5O_layout_t *layout, H5P_genplist_t *plist; /* Property list */ hssize_t ret_value=FAIL; - FUNC_ENTER (H5S_hyper_fwrite, 0); + FUNC_ENTER_NOINIT(H5S_hyper_fwrite); /* Check args */ assert(f); @@ -1895,7 +1895,7 @@ H5S_hyper_fwrite_opt (H5F_t *f, const struct H5O_layout_t *layout, H5P_genplist_t *plist; /* Property list */ hsize_t ret_value=0; /* Return value */ - FUNC_ENTER (H5S_hyper_fwrite_opt, 0); + FUNC_ENTER_NOINIT(H5S_hyper_fwrite_opt); /* Get the hyperslab vector size */ if(TRUE!=H5P_isa_class(dxpl_id,H5P_DATASET_XFER) || NULL == (plist = H5I_object(dxpl_id))) @@ -2450,7 +2450,7 @@ H5S_hyper_mread (const void *_buf, size_t elmt_size, const H5S_t *space, int i; /* Index variable */ hssize_t ret_value=FAIL; - FUNC_ENTER (H5S_hyper_mread, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_mread); /* Check args */ assert(src); @@ -2835,7 +2835,7 @@ H5S_hyper_mread_opt (const void *_buf, size_t elmt_size, size_t duffs_index; /* Counting index for Duff's device */ #endif /* NO_DUFFS_DEVICE */ - FUNC_ENTER (H5S_hyper_mread_opt, 0); + FUNC_ENTER_NOINIT(H5S_hyper_mread_opt); /* Set the aliases for a few important dimension ranks */ fast_dim=mem_space->extent.u.simple.rank-1; @@ -3279,7 +3279,7 @@ H5S_hyper_mwrite (const void *_tconv_buf, size_t elmt_size, const H5S_t *space, int i; /* Index variable */ hssize_t ret_value=FAIL; - FUNC_ENTER (H5S_hyper_mwrite, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_mwrite); /* Check args */ assert(src); @@ -3664,7 +3664,7 @@ H5S_hyper_mwrite_opt (const void *_tconv_buf, size_t elmt_size, size_t duffs_index; /* Counting index for Duff's device */ #endif /* NO_DUFFS_DEVICE */ - FUNC_ENTER (H5S_hyper_mwrite_opt, 0); + FUNC_ENTER_NOINIT(H5S_hyper_mwrite_opt); /* Set the aliases for a few important dimension ranks */ fast_dim=mem_space->extent.u.simple.rank-1; @@ -4123,7 +4123,7 @@ H5S_hyper_new_span (hssize_t low, hssize_t high, H5S_hyper_span_info_t *down, H5 { H5S_hyper_span_t *ret_value=NULL; - FUNC_ENTER (H5S_hyper_new_span, NULL); + FUNC_ENTER_NOINIT(H5S_hyper_new_span); /* Allocate a new span node */ if((ret_value = H5FL_ALLOC(H5S_hyper_span_t,0))==NULL) @@ -4171,7 +4171,7 @@ H5S_hyper_span_precompute_helper (H5S_hyper_span_info_t *spans, size_t elmt_size H5S_hyper_span_t *span; /* Hyperslab span */ herr_t ret_value=FAIL; - FUNC_ENTER (H5S_hyper_span_precompute, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_span_precompute); assert(spans); @@ -4232,7 +4232,7 @@ H5S_hyper_span_precompute (H5S_hyper_span_info_t *spans, size_t elmt_size) { herr_t ret_value=FAIL; - FUNC_ENTER (H5S_hyper_span_precompute, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_span_precompute); assert(spans); @@ -4275,7 +4275,7 @@ H5S_hyper_span_scratch (H5S_hyper_span_info_t *spans, void *scr_value) H5S_hyper_span_t *span; /* Hyperslab span */ herr_t ret_value=FAIL; - FUNC_ENTER (H5S_hyper_span_scratch, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_span_scratch); assert(spans); @@ -4332,7 +4332,7 @@ H5S_hyper_copy_span_helper (H5S_hyper_span_info_t *spans) H5S_hyper_span_info_t *new_down; /* New down span tree */ H5S_hyper_span_info_t *ret_value=NULL; - FUNC_ENTER (H5S_hyper_copy_span_helper, NULL); + FUNC_ENTER_NOINIT(H5S_hyper_copy_span_helper); assert(spans); @@ -4418,7 +4418,7 @@ H5S_hyper_copy_span (H5S_hyper_span_info_t *spans) { H5S_hyper_span_info_t *ret_value=NULL; - FUNC_ENTER (H5S_hyper_copy_span, NULL); + FUNC_ENTER_NOINIT(H5S_hyper_copy_span); assert(spans); @@ -4461,7 +4461,7 @@ H5S_hyper_cmp_spans (H5S_hyper_span_info_t *span_info1, H5S_hyper_span_info_t *s htri_t nest=FAIL; htri_t ret_value=FAIL; - FUNC_ENTER (H5S_hyper_cmp_spans, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_cmp_spans); /* Check for redundant comparison */ if(span_info1==span_info2) @@ -4565,7 +4565,7 @@ H5S_hyper_free_span_info (H5S_hyper_span_info_t *span_info) H5S_hyper_span_t *span, *next_span; herr_t ret_value=SUCCEED; - FUNC_ENTER (H5S_hyper_free_span_info, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_free_span_info); assert(span_info); @@ -4617,7 +4617,7 @@ H5S_hyper_free_span (H5S_hyper_span_t *span) { herr_t ret_value=SUCCEED; - FUNC_ENTER (H5S_hyper_free_span, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_free_span); assert(span); @@ -4740,7 +4740,7 @@ H5S_hyper_select_valid_helper (const H5S_hyper_span_info_t *spans, const hssize_ htri_t tmp; /* temporary return value */ htri_t ret_value=TRUE; /* return value */ - FUNC_ENTER (H5S_hyper_select_valid_helper, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_select_valid_helper); assert(spans); assert(offset); @@ -4976,7 +4976,7 @@ H5S_hyper_select_serialize_helper (const H5S_hyper_span_info_t *spans, hssize_t hsize_t u; /* Index variable */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER (H5S_hyper_select_serialize_helper, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_select_serialize_helper); /* Sanity checks */ assert(spans); @@ -5415,7 +5415,7 @@ H5S_hyper_bounds_helper (const H5S_hyper_span_info_t *spans, const hssize_t *off H5S_hyper_span_t *curr; /* Hyperslab information nodes */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER (H5S_hyper_bounds_helper, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_bounds_helper); assert(spans); assert(offset); @@ -5843,7 +5843,7 @@ H5S_hyper_select_iterate_mem_gen(H5S_hyper_iter_info_t *iter_info) unsigned u; /* Index variable */ herr_t ret_value=FAIL; - FUNC_ENTER (H5S_hyper_select_iterate_mem_gen, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_select_iterate_mem_gen); /* Check args */ assert(iter_info); @@ -6060,7 +6060,7 @@ H5S_hyper_select_iterate_mem_opt(H5S_sel_iter_t UNUSED *iter, void *buf, hid_t t H5T_t *dt; /* Datatype structure */ herr_t user_ret=0; /* User's return value */ - FUNC_ENTER (H5S_hyper_select_iterate_mem_opt, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_select_iterate_mem_opt); /* Set some convienence values */ ndims=space->extent.u.simple.rank; @@ -6373,7 +6373,7 @@ H5S_hyper_select_fill_gen(const void *fill, size_t fill_size, const H5S_t *space unsigned u; /* Index variable */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER (H5S_hyper_select_fill_gen, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_select_fill_gen); /* Set the rank of the fastest changing dimension */ ndims=space->extent.u.simple.rank; @@ -6576,7 +6576,7 @@ H5S_hyper_select_fill_opt(const void *fill, size_t fill_size, const H5S_t *space unsigned ndims; /* Rank of the dataspace */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER (H5S_hyper_select_fill_opt, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_select_fill_opt); /* Set some convienence values */ ndims=space->extent.u.simple.rank; @@ -6749,7 +6749,7 @@ H5S_hyper_recover_span (unsigned *recover, H5S_hyper_span_t **curr_span, H5S_hyp { herr_t ret_value=FAIL; - FUNC_ENTER (H5S_hyper_recover_span, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_recover_span); assert(recover); assert(curr_span); @@ -6801,7 +6801,7 @@ H5S_hyper_append_span (H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t ** sp H5S_hyper_span_t *new_span; herr_t ret_value=FAIL; - FUNC_ENTER (H5S_hyper_append_span, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_append_span); assert(prev_span); assert(span_tree); @@ -6922,7 +6922,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s unsigned recover_a, recover_b; /* Flags to indicate when to recover temporary spans */ herr_t ret_value=FAIL; - FUNC_ENTER (H5S_hyper_clip_spans, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_clip_spans); /* Check args */ assert (a_spans); @@ -7415,7 +7415,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf unsigned recover_a, recover_b; /* Flags to indicate when to recover temporary spans */ H5S_hyper_span_info_t *ret_value=NULL; - FUNC_ENTER (H5S_hyper_merge_spans_helper, NULL); + FUNC_ENTER_NOINIT(H5S_hyper_merge_spans_helper); /* Make certain both 'a' & 'b' spans have down span trees or neither does */ assert((a_spans!=NULL && b_spans!=NULL) || (a_spans==NULL && b_spans==NULL)); @@ -7720,7 +7720,7 @@ H5S_hyper_merge_spans (H5S_t *space, H5S_hyper_span_info_t *new_spans) { herr_t ret_value=FAIL; - FUNC_ENTER (H5S_hyper_merge_spans, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_merge_spans); /* Check args */ assert (space); @@ -7779,7 +7779,7 @@ H5S_hyper_spans_nelem (H5S_hyper_span_info_t *spans) H5S_hyper_span_t *span; /* Hyperslab span */ hssize_t ret_value=FAIL; - FUNC_ENTER (H5S_hyper_spans_nelem, FAIL); + FUNC_ENTER_NOINIT(H5S_hyper_spans_nelem); /* Count the number of elements in the span tree */ if(spans==NULL) @@ -7844,7 +7844,7 @@ H5S_hyper_make_spans (unsigned rank, const hssize_t *start, const hsize_t *strid unsigned u; /* Counters */ H5S_hyper_span_info_t *ret_value=NULL; - FUNC_ENTER (H5S_hyper_make_spans, NULL); + FUNC_ENTER_NOINIT(H5S_hyper_make_spans); /* Check args */ assert (rank>0); @@ -7950,7 +7950,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op, unsigned u; /* Counters */ herr_t ret_value=FAIL; /* return value */ - FUNC_ENTER (H5S_generate_hyperslab, FAIL); + FUNC_ENTER_NOINIT(H5S_generate_hyperslab); /* Check args */ assert(space); @@ -8432,7 +8432,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper hssize_t nelem; /* Number of elements in hyperslab span tree */ herr_t ret_value=FAIL; /* return value */ - FUNC_ENTER (H5S_operate_hyperslab, NULL); + FUNC_ENTER_NOINIT(H5S_operate_hyperslab); /* Check args */ assert(result); @@ -8602,7 +8602,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op, unsigned u; /* Counters */ herr_t ret_value=FAIL; /* return value */ - FUNC_ENTER (H5S_generate_hyperslab, FAIL); + FUNC_ENTER_NOINIT(H5S_generate_hyperslab); /* Check args */ assert(space); @@ -9025,7 +9025,7 @@ H5S_combine_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2) H5S_t *new_space=NULL; /* New dataspace generated */ H5S_t *ret_value=NULL; /* return value */ - FUNC_ENTER (H5S_combine_select, NULL); + FUNC_ENTER_NOINIT(H5S_combine_select); /* Check args */ assert(space1); @@ -9140,7 +9140,7 @@ H5S_select_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2) H5S_hyper_span_info_t *tmp_spans=NULL; /* Temporary copy of selection */ herr_t ret_value=FAIL; /* return value */ - FUNC_ENTER (H5S_select_select, FAIL); + FUNC_ENTER_NOINIT(H5S_select_select); /* Check args */ assert(space1); diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 2f2bd89..cb49b8f 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -81,7 +81,7 @@ H5S_mpio_spaces_xfer(H5F_t *f, const H5O_layout_t *layout, * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5S_mpio_all_type( const H5S_t *space, const size_t elmt_size, /* out: */ MPI_Datatype *new_type, @@ -91,7 +91,7 @@ H5S_mpio_all_type( const H5S_t *space, const size_t elmt_size, hsize_t total_bytes; unsigned u; - FUNC_ENTER (H5S_mpio_all_type, FAIL); + FUNC_ENTER_NOINIT(H5S_mpio_all_type); /* Check args */ assert (space); @@ -137,7 +137,7 @@ H5S_mpio_all_type( const H5S_t *space, const size_t elmt_size, * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5S_mpio_hyper_type( const H5S_t *space, const size_t elmt_size, /* out: */ MPI_Datatype *new_type, @@ -162,7 +162,7 @@ H5S_mpio_hyper_type( const H5S_t *space, const size_t elmt_size, MPI_Datatype inner_type, outer_type, old_type[2]; MPI_Aint extent_len, displacement[2]; - FUNC_ENTER (H5S_mpio_hyper_type, FAIL); + FUNC_ENTER_NOINIT(H5S_mpio_hyper_type); /* Check and abbreviate args */ assert (space); @@ -459,7 +459,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5S_mpio_space_type( const H5S_t *space, const size_t elmt_size, /* out: */ MPI_Datatype *new_type, @@ -469,7 +469,7 @@ H5S_mpio_space_type( const H5S_t *space, const size_t elmt_size, int err; herr_t ret_value = SUCCEED; - FUNC_ENTER (H5S_mpio_space_type, FAIL); + FUNC_ENTER_NOINIT(H5S_mpio_space_type); /* Check args */ assert (space); @@ -564,7 +564,7 @@ H5S_mpio_spaces_xfer(H5F_t *f, const H5O_layout_t *layout, mft_is_derived=0; H5P_genplist_t *plist; /* Property list pointer */ - FUNC_ENTER (H5S_mpio_spaces_xfer, FAIL); + FUNC_ENTER_NOINIT(H5S_mpio_spaces_xfer); /* Check args */ assert (f); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 6b9cd30..6b80064 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -595,7 +595,7 @@ H5S_get_select_hyper_nblocks(H5S_t *space) hssize_t ret_value=FAIL; /* return value */ unsigned u; /* Counter */ - FUNC_ENTER (H5S_get_select_hyper_nblocks, FAIL); + FUNC_ENTER_NOINIT(H5S_get_select_hyper_nblocks); assert(space); @@ -674,7 +674,7 @@ H5S_get_select_elem_npoints(H5S_t *space) { hssize_t ret_value=FAIL; /* return value */ - FUNC_ENTER (H5S_get_select_elem_npoints, FAIL); + FUNC_ENTER_NOINIT(H5S_get_select_elem_npoints); assert(space); @@ -770,7 +770,7 @@ H5S_get_select_hyper_blocklist(H5S_t *space, hsize_t startblock, hsize_t numbloc int done; /* Whether we are done with the iteration */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER (H5S_get_select_hyper_blocklist, FAIL); + FUNC_ENTER_NOINIT(H5S_get_select_hyper_blocklist); assert(space); assert(buf); @@ -962,7 +962,7 @@ H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoint int rank; /* Dataspace rank */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER (H5S_get_select_elem_pointlist, FAIL); + FUNC_ENTER_NOINIT(H5S_get_select_elem_pointlist); assert(space); assert(buf); @@ -1079,7 +1079,7 @@ H5S_get_select_bounds(H5S_t *space, hsize_t *start, hsize_t *end) int i; /* index variable */ herr_t ret_value=FAIL; /* return value */ - FUNC_ENTER (H5S_get_select_bounds, FAIL); + FUNC_ENTER_NOINIT(H5S_get_select_bounds); assert(space); assert(start); @@ -279,7 +279,7 @@ H5T_init_interface(void) herr_t status; herr_t ret_value=SUCCEED; - FUNC_ENTER(H5T_init_interface, FAIL); + FUNC_ENTER_NOINIT(H5T_init_interface); /* Initialize the atom group for the file IDs */ if (H5I_init_group(H5I_DATATYPE, H5I_DATATYPEID_HASHSIZE, H5T_RESERVED_ATOMS, (H5I_free_t)H5T_close)<0) @@ -1930,11 +1930,13 @@ H5T_unlock_cb (void *_dt, hid_t UNUSED id, const void UNUSED *key) { H5T_t *dt = (H5T_t *)_dt; - FUNC_ENTER (H5T_unlock_cb, FAIL); + FUNC_ENTER_NOINIT(H5T_unlock_cb); + assert (dt); if (H5T_STATE_IMMUTABLE==dt->state) { dt->state = H5T_STATE_RDONLY; } + FUNC_LEAVE (0); } @@ -1965,6 +1967,8 @@ H5T_term_interface(void) int i, nprint=0, n=0; H5T_path_t *path = NULL; + FUNC_ENTER_NOINIT(H5T_term_interface); + if (interface_initialize_g) { /* Unregister all conversion functions */ for (i=0; i<H5T_g.npaths; i++) { @@ -2101,7 +2105,7 @@ H5T_term_interface(void) interface_initialize_g = 0; n = 1; /*H5I*/ } - return n; + FUNC_LEAVE(n); } @@ -4709,7 +4713,7 @@ H5T_vlen_create(H5T_t *base) H5T_t *dt = NULL; /*new VL data type */ H5T_t *ret_value = NULL; /*return value */ - FUNC_ENTER(H5T_vlen_create, NULL); + FUNC_ENTER_NOINIT(H5T_vlen_create); /* Check args */ assert(base); @@ -4901,7 +4905,7 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, int i; /*counter */ herr_t ret_value=SUCCEED; /*return value */ - FUNC_ENTER(H5T_register, FAIL); + FUNC_ENTER_NOINIT(H5T_register); /* Check args */ assert(src); @@ -8105,7 +8109,7 @@ H5T_print_stats(H5T_path_t * UNUSED path, int * UNUSED nprint/*in,out*/) char bandwidth[32]; #endif - FUNC_ENTER(H5T_print_stats, FAIL); + FUNC_ENTER_NOINIT(H5T_print_stats); #ifdef H5T_DEBUG if (H5DEBUG(T) && path->stats.ncalls>0) { @@ -1020,7 +1020,7 @@ H5TB_dump(H5TB_TREE *tree, void (*key_dump)(void *,void *), int method) static herr_t H5TB_printNode(H5TB_NODE * node, void(*key_dump)(void *,void *)) { - FUNC_ENTER(H5TB_printNode,FAIL); + FUNC_ENTER_NOINIT(H5TB_printNode); if (node == NULL) { printf("ERROR: null node pointer\n"); @@ -1061,7 +1061,7 @@ static herr_t H5TB_dumpNode(H5TB_NODE *node, void (*key_dump)(void *,void *), int method) { - FUNC_ENTER(H5TB_dumpNode,FAIL); + FUNC_ENTER_NOINIT(H5TB_dumpNode); if (node == NULL) HRETURN(FAIL); @@ -1118,7 +1118,7 @@ H5TB_dumpNode(H5TB_NODE *node, void (*key_dump)(void *,void *), static H5TB_NODE * H5TB_end(H5TB_NODE * root, int side) { - FUNC_ENTER (H5TB_end, NULL); + FUNC_ENTER_NOINIT(H5TB_end); assert(root); assert(side==LEFT || side==RIGHT); @@ -1133,7 +1133,7 @@ H5TB_end(H5TB_NODE * root, int side) static H5TB_NODE * H5TB_nbr(H5TB_NODE * ptr, int side) { - FUNC_ENTER (H5TB_nbr, NULL); + FUNC_ENTER_NOINIT(H5TB_nbr); if (!HasChild(ptr, side)) HRETURN (ptr->link[side]); @@ -1157,7 +1157,7 @@ H5TB_ffind(H5TB_NODE * root, void * key, unsigned fast_compare, H5TB_NODE ** pp) int cmp = 1; H5TB_NODE *ret_value = NULL; - FUNC_ENTER (H5TB_ffind, NULL); + FUNC_ENTER_NOINIT(H5TB_ffind); switch(fast_compare) { case H5TB_FAST_HADDR_COMPARE: @@ -1231,7 +1231,7 @@ H5TB_swapkid(H5TB_NODE ** root, H5TB_NODE * ptr, int side) H5TB_leaf plcnt, prcnt, /* current values of the ptr's and kid's leaf count */ klcnt, krcnt; - FUNC_ENTER (H5TB_swapkid, NULL); + FUNC_ENTER_NOINIT(H5TB_swapkid); deep[2] = (deep[1] = 0) + Delta(kid, side); deep[0] = Max(0, deep[2]) + 1 - Delta(ptr, side); @@ -1333,7 +1333,7 @@ H5TB_balance(H5TB_NODE ** root, H5TB_NODE * ptr, int side, int added) int odelta; int obal; - FUNC_ENTER(H5TB_balance,FAIL); + FUNC_ENTER_NOINIT(H5TB_balance); while (NULL != ptr) { odelta = Delta(ptr, side); /* delta before the node was added */ diff --git a/src/H5Tbit.c b/src/H5Tbit.c index b868fa5..a89e2e8 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -317,10 +317,12 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, ssize_t idx, i; size_t iu; + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5T_bit_find); + /* Some functions call this with value=TRUE */ assert (TRUE==1); - switch (direction) { case H5T_BIT_LSB: /* Calculate index */ @@ -331,7 +333,7 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, if (offset) { for (iu=offset; iu<8 && size>0; iu++, size--) { if (value==(hbool_t)((buf[idx]>>iu) & 0x01)) { - return 8*idx+(ssize_t)iu - base; + HRETURN(8*idx+(ssize_t)iu - base); } } offset = 0; @@ -342,7 +344,7 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, if ((value?0x00:0xff)!=buf[idx]) { for (i=0; i<8; i++) { if (value==(hbool_t)((buf[idx]>>i) & 0x01)) { - return 8*idx+i - base; + HRETURN(8*idx+i - base); } } } @@ -352,7 +354,7 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, /* End */ for (i=0; i<(ssize_t)size; i++) { if (value==(hbool_t)((buf[idx]>>i) & 0x01)) { - return 8*idx+i - base; + HRETURN(8*idx+i - base); } } break; @@ -366,7 +368,7 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, if (size>8-offset && (offset+size)%8) { for (iu=(offset+size)%8; iu>0; --iu, --size) { if (value==(hbool_t)((buf[idx]>>(iu-1)) & 0x01)) { - return 8*idx+(ssize_t)(iu-1) - base; + HRETURN(8*idx+(ssize_t)(iu-1) - base); } } --idx; @@ -376,7 +378,7 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, if ((value?0x00:0xff)!=buf[idx]) { for (i=7; i>=0; --i) { if (value==(hbool_t)((buf[idx]>>i) & 0x01)) { - return 8*idx+i - base; + HRETURN(8*idx+i - base); } } } @@ -387,7 +389,7 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, if (size>0) { for (iu=offset+size; iu>offset; --iu) { if (value==(hbool_t)((buf[idx]>>(iu-1)) & 0x01)) { - return 8*idx+(ssize_t)(iu-1) - base; + HRETURN(8*idx+(ssize_t)(iu-1) - base); } } } @@ -395,7 +397,7 @@ H5T_bit_find (uint8_t *buf, size_t offset, size_t size, H5T_sdir_t direction, } - return -1; + FUNC_LEAVE(-1); } @@ -423,6 +425,9 @@ H5T_bit_inc(uint8_t *buf, size_t start, size_t size) unsigned carry = 1; unsigned acc, mask; + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5T_bit_find); + assert(buf); start %= 8; @@ -460,5 +465,5 @@ H5T_bit_inc(uint8_t *buf, size_t start, size_t size) buf[idx] |= acc & mask; } - return carry ? TRUE : FALSE; + FUNC_LEAVE(carry ? TRUE : FALSE); } diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 7a01133..56c05b2 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -1207,7 +1207,7 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) H5T_t *type = NULL; hid_t tid; - FUNC_ENTER (H5T_conv_struct_init, FAIL); + FUNC_ENTER_NOINIT(H5T_conv_struct_init); if (!priv) { /* @@ -1841,7 +1841,7 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) herr_t ret_value=FAIL; /*return value */ int i, j; /*counters */ - FUNC_ENTER(H5T_conv_enum_init, FAIL); + FUNC_ENTER_NOINIT(H5T_conv_enum_init); cdata->need_bkg = H5T_BKG_NO; if (NULL==(priv=cdata->priv=H5MM_calloc(sizeof(*priv)))) { diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 3fac495..32cad50 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -29,6 +29,7 @@ static int interface_initialize_g = 0; #define INTERFACE_INIT NULL /* Local functions */ +static htri_t H5T_vlen_set_loc(H5T_t *dt, H5F_t *f, H5T_vlen_loc_t loc); static herr_t H5T_vlen_reclaim_recurse(void *elem, H5T_t *dt, H5MM_free_t free_func, void *free_info); @@ -55,7 +56,7 @@ H5T_vlen_set_loc(H5T_t *dt, H5F_t *f, H5T_vlen_loc_t loc) { htri_t ret_value = 0; /* Indicate that success, but no location change */ - FUNC_ENTER (H5T_vlen_set_loc, FAIL); + FUNC_ENTER_NOINIT(H5T_vlen_set_loc); /* check parameters */ assert(dt); @@ -528,7 +529,7 @@ H5T_vlen_reclaim_recurse(void *elem, H5T_t *dt, H5MM_free_t free_func, void *fre size_t j; /* local index variable */ herr_t ret_value = SUCCEED; - FUNC_ENTER(H5T_vlen_reclaim_recurse, FAIL); + FUNC_ENTER_NOINIT(H5T_vlen_reclaim_recurse); assert(elem); assert(dt); @@ -344,19 +344,22 @@ H5V_hyper_eq(int n, hsize_t nelmts1 = 1, nelmts2 = 1; int i; - if (n <= 0) return TRUE; + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5V_hyper_eq); + + if (n <= 0) HRETURN(TRUE); for (i=0; i<n; i++) { if ((offset1 ? offset1[i] : 0) != (offset2 ? offset2[i] : 0)) { - return FALSE; + HRETURN(FALSE); } if ((size1 ? size1[i] : 0) != (size2 ? size2[i] : 0)) { - return FALSE; + HRETURN(FALSE); } - if (0 == (nelmts1 *= (size1 ? size1[i] : 0))) return FALSE; - if (0 == (nelmts2 *= (size2 ? size2[i] : 0))) return FALSE; + if (0 == (nelmts1 *= (size1 ? size1[i] : 0))) HRETURN(FALSE); + if (0 == (nelmts2 *= (size2 ? size2[i] : 0))) HRETURN(FALSE); } - return TRUE; + FUNC_LEAVE(TRUE); } /*------------------------------------------------------------------------- @@ -384,24 +387,27 @@ H5V_hyper_disjointp(unsigned n, { unsigned u; - if (!n || !size1 || !size2) return TRUE; + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5V_hyper_disjointp); + + if (!n || !size1 || !size2) HRETURN(TRUE); for (u=0; u<n; u++) { assert (size1[u]<HSSIZET_MAX); assert (size2[u]<HSSIZET_MAX); if (0==size1[u] || 0==size2[u]) - return TRUE; + HRETURN(TRUE); if (((offset1?offset1[u]:0) < (offset2?offset2[u]:0) && ((offset1?offset1[u]:0) + (hssize_t)size1[u] <= (offset2?offset2[u]:0))) || ((offset2?offset2[u]:0) < (offset1?offset1[u]:0) && ((offset2?offset2[u]:0) + (hssize_t)size2[u] <= (offset1?offset1[u]:0)))) { - return TRUE; + HRETURN(TRUE); } } - return FALSE; + FUNC_LEAVE(FALSE); } /*------------------------------------------------------------------------- diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h index 063d92a..156e6bd 100644 --- a/src/H5Vprivate.h +++ b/src/H5Vprivate.h @@ -100,9 +100,12 @@ H5V_vector_reduce_product(unsigned n, const hsize_t *v) { hsize_t ans = 1; - if (n && !v) return 0; + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5V_vector_reduce_product); + + if (n && !v) HRETURN(0); while (n--) ans *= *v++; - return ans; + FUNC_LEAVE(ans); } /*------------------------------------------------------------------------- @@ -125,11 +128,14 @@ H5V_vector_reduce_product(unsigned n, const hsize_t *v) static H5_inline htri_t UNUSED H5V_vector_zerop_u(int n, const hsize_t *v) { - if (!v) return TRUE; + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5V_vector_zerop_u); + + if (!v) HRETURN(TRUE); while (n--) { - if (*v++) return FALSE; + if (*v++) HRETURN(FALSE); } - return TRUE; + FUNC_LEAVE(TRUE); } /*------------------------------------------------------------------------- @@ -152,11 +158,14 @@ H5V_vector_zerop_u(int n, const hsize_t *v) static H5_inline htri_t UNUSED H5V_vector_zerop_s(int n, const hssize_t *v) { - if (!v) return TRUE; + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5V_vector_zerop_s); + + if (!v) HRETURN(TRUE); while (n--) { - if (*v++) return FALSE; + if (*v++) HRETURN(FALSE); } - return TRUE; + FUNC_LEAVE(TRUE); } /*------------------------------------------------------------------------- @@ -181,14 +190,17 @@ H5V_vector_zerop_s(int n, const hssize_t *v) static H5_inline int UNUSED H5V_vector_cmp_u (int n, const hsize_t *v1, const hsize_t *v2) { - if (v1 == v2) return 0; + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5V_vector_cmp_u); + + if (v1 == v2) HRETURN(0); while (n--) { - if ((v1 ? *v1 : 0) < (v2 ? *v2 : 0)) return -1; - if ((v1 ? *v1 : 0) > (v2 ? *v2 : 0)) return 1; + if ((v1 ? *v1 : 0) < (v2 ? *v2 : 0)) HRETURN(-1); + if ((v1 ? *v1 : 0) > (v2 ? *v2 : 0)) HRETURN(1); if (v1) v1++; if (v2) v2++; } - return 0; + FUNC_LEAVE(0); } @@ -214,14 +226,17 @@ H5V_vector_cmp_u (int n, const hsize_t *v1, const hsize_t *v2) static H5_inline int UNUSED H5V_vector_cmp_s (unsigned n, const hssize_t *v1, const hssize_t *v2) { - if (v1 == v2) return 0; + /* Use FUNC_ENTER_NOINIT here to avoid performance issues */ + FUNC_ENTER_NOINIT(H5V_vector_cmp_s); + + if (v1 == v2) HRETURN(0); while (n--) { - if ((v1 ? *v1 : 0) < (v2 ? *v2 : 0)) return -1; - if ((v1 ? *v1 : 0) > (v2 ? *v2 : 0)) return 1; + if ((v1 ? *v1 : 0) < (v2 ? *v2 : 0)) HRETURN(-1); + if ((v1 ? *v1 : 0) > (v2 ? *v2 : 0)) HRETURN(1); if (v1) v1++; if (v2) v2++; } - return 0; + FUNC_LEAVE(0); } @@ -42,7 +42,7 @@ static H5Z_class_t *H5Z_table_g = NULL; static herr_t H5Z_init_interface (void) { - FUNC_ENTER (H5Z_init_interface, FAIL); + FUNC_ENTER_NOINIT(H5Z_init_interface); H5Z_register (H5Z_FILTER_DEFLATE, "deflate", H5Z_filter_deflate); diff --git a/src/H5detect.c b/src/H5detect.c index 0c789b7..1c650ea 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -419,7 +419,9 @@ int\n\ H5TN_term_interface(void)\n\ {\n\ interface_initialize_g = 0;\n\ - return 0;\n\ + FUNC_ENTER_NOINIT(H5TN_term_interface);\n\ + \n\ + FUNC_LEAVE(0);\n\ }\n"); /* The interface initialization function */ diff --git a/src/H5private.h b/src/H5private.h index 15721db..a849fe0 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -990,16 +990,12 @@ typedef struct H5_api_struct { /* Macros for threadsafe HDF-5 Phase I locks */ #define H5_LOCK_API_MUTEX \ H5TS_mutex_lock(&H5_g.init_lock) -#define H5_API_LOCK_BEGIN \ - if (H5_IS_API(FUNC)) { \ - H5_LOCK_API_MUTEX; -#define H5_API_LOCK_END } +#define H5_API_LOCK \ + if (H5_IS_API(FUNC)) { H5_LOCK_API_MUTEX; } #define H5_UNLOCK_API_MUTEX \ H5TS_mutex_unlock(&H5_g.init_lock) -#define H5_API_UNLOCK_BEGIN \ - if (H5_IS_API(FUNC)) { \ - H5_UNLOCK_API_MUTEX; -#define H5_API_UNLOCK_END } +#define H5_API_UNLOCK \ + if (H5_IS_API(FUNC)) { H5_UNLOCK_API_MUTEX; } /* Macros for thread cancellation-safe mechanism */ #define H5_API_UNSET_CANCEL \ @@ -1021,11 +1017,9 @@ extern H5_api_t H5_g; /* disable locks (sequential version) */ #define H5_LOCK_API_MUTEX -#define H5_API_LOCK_BEGIN -#define H5_API_LOCK_END +#define H5_API_LOCK #define H5_UNLOCK_API_MUTEX -#define H5_API_UNLOCK_BEGIN -#define H5_API_UNLOCK_END +#define H5_API_UNLOCK /* disable cancelability (sequential version) */ #define H5_API_UNSET_CANCEL @@ -1039,45 +1033,71 @@ extern hbool_t H5_libinit_g; /* Has the library been initialized? */ #endif /* H5_HAVE_THREADSAFE */ -#define FUNC_ENTER(func_name,err) FUNC_ENTER_INIT(func_name,INTERFACE_INIT,err) - -#define FUNC_ENTER_INIT(func_name,interface_init_func,err) { \ +#define FUNC_ENTER_COMMON(func_name) \ CONSTR (FUNC, #func_name); \ PABLO_SAVE (ID_ ## func_name) \ H5TRACE_DECL; \ \ + /* Start tracing */ \ PABLO_TRACE_ON (PABLO_MASK, pablo_func_id); \ \ - /* Initialize the library */ \ + /* Initialize the thread-safe code */ \ H5_FIRST_THREAD_INIT; \ + \ + /* Grab the mutex for the library */ \ H5_API_UNSET_CANCEL \ - H5_API_LOCK_BEGIN \ - \ + H5_API_LOCK + +#define FUNC_ENTER(func_name,err) { \ + FUNC_ENTER_COMMON(func_name); \ + FUNC_ENTER_API_INIT(func_name,INTERFACE_INIT,err) + +#define FUNC_ENTER_NOAPI(func_name,err) { \ + FUNC_ENTER_COMMON(func_name); \ + FUNC_ENTER_NOAPI_INIT(func_name,INTERFACE_INIT,err) + +#define FUNC_ENTER_NOINIT(func_name) { \ + FUNC_ENTER_COMMON(func_name); \ + { + +#define FUNC_ENTER_API_INIT(func_name,interface_init_func,err) \ /* Initialize the library */ \ - if (!(H5_INIT_GLOBAL)) { \ + if (H5_IS_API(FUNC) && !(H5_INIT_GLOBAL)) { \ H5_INIT_GLOBAL = TRUE; \ if (H5_init_library()<0) { \ - HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ + HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ "library initialization failed"); \ } \ - } \ - H5_API_LOCK_END \ + } \ \ /* Initialize this interface or bust */ \ if (!interface_initialize_g) { \ interface_initialize_g = 1; \ if (interface_init_func && \ ((herr_t(*)(void))interface_init_func)()<0) { \ - interface_initialize_g = 0; \ - HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ + interface_initialize_g = 0; \ + HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ "interface initialization failed"); \ - } \ - } \ + } \ + } \ \ /* Clear thread error stack entering public functions */ \ - if (H5_IS_API(FUNC) && H5E_clearable_g) { \ - H5E_clear (); \ - } \ + if (H5_IS_API(FUNC) && H5E_clearable_g) { \ + H5E_clear (); \ + } \ + { + +#define FUNC_ENTER_NOAPI_INIT(func_name,interface_init_func,err) \ + /* Initialize this interface or bust */ \ + if (!interface_initialize_g) { \ + interface_initialize_g = 1; \ + if (interface_init_func && \ + ((herr_t(*)(void))interface_init_func)()<0) { \ + interface_initialize_g = 0; \ + HRETURN_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ + "interface initialization failed"); \ + } \ + } \ { /*------------------------------------------------------------------------- @@ -1095,14 +1115,17 @@ extern hbool_t H5_libinit_g; /* Has the library been initialized? */ * *------------------------------------------------------------------------- */ -#define FUNC_LEAVE(return_value) HRETURN(return_value)}} +#define FUNC_LEAVE(return_value) \ + HRETURN(return_value) \ + } /*end scope from end of FUNC_ENTER*/ \ +} /*end scope from beginning of FUNC_ENTER*/ /* * The FUNC_ENTER() and FUNC_LEAVE() macros make calls to Pablo functions * through one of these two sets of macros. */ #ifdef H5_HAVE_PABLO -# define PABLO_SAVE(func_id) int pablo_func_id = func_id; +# define PABLO_SAVE(func_id) const int pablo_func_id = func_id; # define PABLO_TRACE_ON(m, f) TRACE_ON(m,f) # define PABLO_TRACE_OFF(m, f) TRACE_OFF(m,f) #else |