diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2002-05-28 18:17:12 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2002-05-28 18:17:12 (GMT) |
commit | ca912c389e4e641cfbae6facced950ad05578d65 (patch) | |
tree | 6bd8604f6a587ee07013ad40daa3c0c7f4b31c26 /src/H5F.c | |
parent | 893cf5899c2b724aa438b66a275967b1f5ad0342 (diff) | |
download | hdf5-ca912c389e4e641cfbae6facced950ad05578d65.zip hdf5-ca912c389e4e641cfbae6facced950ad05578d65.tar.gz hdf5-ca912c389e4e641cfbae6facced950ad05578d65.tar.bz2 |
[svn-r5467] Purpose:
Code cleanup.
Description:
Took Robb's recent ideas for improving the FUNC_ENTER/FUNC_LEAVE macros
equivalents in the SAF library and adapted them to our library. I added
an additional macro which is equivalent to FUNC_ENTER:
FUNC_ENTER_NOINIT - Has the API tracing code, etc. from FUNC_ENTER but
none of the library or interface initialization code. This is to
be used _only_ for static functions and those which explicitly
cannot have the library or interface initialization code enabled
(like the API termination routines, etc.).
This allowed many more of the functions in the library [but not all yet :-(]
to be wrapped with FUNC_ENTER[_NOINIT]/FUNC_LEAVE pairs.
It also reduced the size of the library and executables (by cutting out a
bunch of code which was never executed), I'll e-mail the exact results when
I've finished editing it.
Platforms tested:
IRIX64 6.5 (modi4)
Diffstat (limited to 'src/H5F.c')
-rw-r--r-- | src/H5F.c | 45 |
1 files changed, 30 insertions, 15 deletions
@@ -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); } |