summaryrefslogtreecommitdiffstats
path: root/src/H5Bdbg.c
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2024-03-09 07:17:13 (GMT)
committerGitHub <noreply@github.com>2024-03-09 07:17:13 (GMT)
commit3d09a7d5f6dd0f602a8f343809384ed00cd13f5c (patch)
tree00ea6998f2c44ae9d0e6460bc617b0639abc2734 /src/H5Bdbg.c
parentd8af09dd8f064c97c4120b2a5d1cfd1103526d07 (diff)
downloadhdf5-3d09a7d5f6dd0f602a8f343809384ed00cd13f5c.zip
hdf5-3d09a7d5f6dd0f602a8f343809384ed00cd13f5c.tar.gz
hdf5-3d09a7d5f6dd0f602a8f343809384ed00cd13f5c.tar.bz2
Remove H5B debug checks (#4089)
The H5B (version 1 B-tree) package would add some computationally expensive integrity checks when H5B_DEBUG was defined. Due to their negative effects on performance, this option was rarely turned on, making the H5B__assert() check function stale, if not dead, code. This change: * Builds H5B__assert() when NDEBUG is not defined (the function relies on assert()) so it gets compiled more often. * Removes some printf debugging statements in the B-tree code * Removes all H5B "extra debug" checks that are leftover from past debugging sessions. Maintainers can add H5B__assert() selectively to perform integrity checks when debugging. * Removes the HDF5_ENABLE_DEBUG_H5B CMake option H5B_DEBUG now has no effect
Diffstat (limited to 'src/H5Bdbg.c')
-rw-r--r--src/H5Bdbg.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c
index 73eccec..9b12da1 100644
--- a/src/H5Bdbg.c
+++ b/src/H5Bdbg.c
@@ -14,7 +14,7 @@
*
* Created: H5Bdbg.c
*
- * Purpose: Debugging routines for B-link tree package.
+ * Purpose: Debugging routines for B-link tree package
*
*-------------------------------------------------------------------------
*/
@@ -36,10 +36,9 @@
/*-------------------------------------------------------------------------
* Function: H5B_debug
*
- * Purpose: Prints debugging info about a B-tree.
+ * Purpose: Prints debugging info about a B-tree
*
* Return: Non-negative on success/Negative on failure
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -132,15 +131,15 @@ done:
/*-------------------------------------------------------------------------
* Function: H5B__assert
*
- * Purpose: Verifies that the tree is structured correctly.
- *
- * Return: Success: SUCCEED
+ * Purpose: Verifies that the tree is structured correctly
*
- * Failure: aborts if something is wrong.
+ * Relies on assert(), so only built when NDEBUG is not set
*
+ * Return: Success: SUCCEED
+ * Failure: assert()
*-------------------------------------------------------------------------
*/
-#ifdef H5B_DEBUG
+#ifndef NDEBUG
herr_t
H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata)
{
@@ -149,7 +148,6 @@ H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata)
H5B_shared_t *shared; /* Pointer to shared B-tree info */
H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */
int ncell, cmp;
- static int ncalls = 0;
herr_t status;
herr_t ret_value = SUCCEED; /* Return value */
@@ -162,11 +160,6 @@ H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata)
FUNC_ENTER_PACKAGE
- if (0 == ncalls++) {
- if (H5DEBUG(B))
- fprintf(H5DEBUG(B), "H5B: debugging B-trees (expensive)\n");
- } /* end if */
-
/* Get shared info for B-tree */
if (NULL == (rc_shared = (type->get_shared)(f, udata)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object");
@@ -257,4 +250,4 @@ H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B__assert() */
-#endif /* H5B_DEBUG */
+#endif /* !NDEBUG */