Skip to content

Commit

Permalink
Remove printf debugging in H5HL code (#4086)
Browse files Browse the repository at this point in the history
  • Loading branch information
derobins authored Mar 8, 2024
1 parent 871a49f commit f244960
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 39 deletions.
1 change: 0 additions & 1 deletion config/cmake/HDFCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ if (HDF5_ENABLE_DEBUG_APIS)
H5D_DEBUG
H5D_CHUNK_DEBUG
H5F_DEBUG
H5HL_DEBUG
H5I_DEBUG
H5MM_DEBUG
H5O_DEBUG
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2572,8 +2572,8 @@ AC_SUBST([INTERNAL_DEBUG_OUTPUT])
## too specialized or have huge performance hits. These
## are not listed in the "all" packages list.
##
## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,MM,O,S,T,Z"
all_packages="AC,B2,CX,D,F,HL,I,MM,O,S,T,Z"
## all_packages="AC,B,B2,D,F,FA,FL,FS,I,MM,O,S,T,Z"
all_packages="AC,B2,CX,D,F,I,MM,O,S,T,Z"

case "X-$INTERNAL_DEBUG_OUTPUT" in
X-yes|X-all)
Expand Down
29 changes: 2 additions & 27 deletions src/H5HL.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,15 +648,8 @@ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *of
assert(last_fl->offset == H5HL_ALIGN(last_fl->offset));
assert(last_fl->size == H5HL_ALIGN(last_fl->size));

if (last_fl->size < H5HL_SIZEOF_FREE(f)) {
#ifdef H5HL_DEBUG
if (H5DEBUG(HL) && last_fl->size) {
fprintf(H5DEBUG(HL), "H5HL: lost %lu bytes at line %d\n", (unsigned long)(last_fl->size),
__LINE__);
}
#endif
if (last_fl->size < H5HL_SIZEOF_FREE(f))
last_fl = H5HL__remove_free(heap, last_fl);
}
}
else {
/* Create a new free list element large enough that we can
Expand All @@ -675,21 +668,9 @@ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *of
if (heap->freelist)
heap->freelist->prev = fl;
heap->freelist = fl;
#ifdef H5HL_DEBUG
}
else if (H5DEBUG(HL) && need_more > need_size) {
fprintf(H5DEBUG(HL), "H5HL_insert: lost %lu bytes at line %d\n",
(unsigned long)(need_more - need_size), __LINE__);
#endif
}
}

#ifdef H5HL_DEBUG
if (H5DEBUG(HL)) {
fprintf(H5DEBUG(HL), "H5HL: resize mem buf from %lu to %lu bytes\n",
(unsigned long)(old_dblk_size), (unsigned long)(old_dblk_size + need_more));
}
#endif
if (NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, heap->dblk_size)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed");

Expand Down Expand Up @@ -822,14 +803,8 @@ H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size)
* hold the free list data. If not, the freed chunk is forever
* lost.
*/
if (size < H5HL_SIZEOF_FREE(f)) {
#ifdef H5HL_DEBUG
if (H5DEBUG(HL)) {
fprintf(H5DEBUG(HL), "H5HL: lost %lu bytes\n", (unsigned long)size);
}
#endif
if (size < H5HL_SIZEOF_FREE(f))
HGOTO_DONE(SUCCEED);
}

/* Add an entry to the free list */
if (NULL == (fl = H5FL_MALLOC(H5HL_free_t)))
Expand Down
10 changes: 1 addition & 9 deletions src/H5HLprivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* Created: H5HLprivate.h
*
* Purpose: Private declarations for the H5HL (local heap) package.
* Purpose: Private declarations for the H5HL (local heap) package
*
*-------------------------------------------------------------------------
*/
Expand All @@ -26,14 +26,6 @@
#include "H5ACprivate.h" /* Metadata cache */
#include "H5Fprivate.h" /* File access */

/*
* Feature: Define H5HL_DEBUG on the compiler command line if you want to
* enable diagnostic messages from this layer.
*/
#ifdef NDEBUG
#undef H5HL_DEBUG
#endif

#define H5HL_ALIGN(X) ((((unsigned)X) + 7) & (unsigned)(~0x07)) /* align on 8-byte boundary */

#define H5HL_SIZEOF_FREE(F) \
Expand Down

0 comments on commit f244960

Please sign in to comment.