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/H5Vprivate.h | |
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/H5Vprivate.h')
-rw-r--r-- | src/H5Vprivate.h | 47 |
1 files changed, 31 insertions, 16 deletions
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); } |