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/H5G.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/H5G.c')
-rw-r--r-- | src/H5G.c | 29 |
1 files changed, 21 insertions, 8 deletions
@@ -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); } |