From 6e90b1fdb6f69a09089905d7a3346ce944a779f3 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 13 Apr 2023 13:25:50 -0500 Subject: Refactor H5C_entry_in_skip_list (#2719) * Refactor H5C__entry_in_skip_list to package scope --- src/H5C.c | 16 ++++++++++++---- src/H5Cpkg.h | 14 +++++++++----- src/H5Cprivate.h | 4 ---- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/H5C.c b/src/H5C.c index f6bc1ff..2bce704 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -7050,7 +7050,7 @@ done: /*------------------------------------------------------------------------- * - * Function: H5C_entry_in_skip_list + * Function: H5C__entry_in_skip_list * * Purpose: Debugging function that scans skip list to see if it * is in present. We need this, as it is possible for @@ -7065,11 +7065,15 @@ done: */ #ifdef H5C_DO_SLIST_SANITY_CHECKS hbool_t -H5C_entry_in_skip_list(H5C_t *cache_ptr, H5C_cache_entry_t *target_ptr) +H5C__entry_in_skip_list(H5C_t *cache_ptr, H5C_cache_entry_t *target_ptr) { H5SL_node_t *node_ptr; hbool_t in_slist; + hbool_t ret_value; + FUNC_ENTER_PACKAGE + + /* Assertions */ HDassert(cache_ptr); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(cache_ptr->slist_ptr); @@ -7092,8 +7096,12 @@ H5C_entry_in_skip_list(H5C_t *cache_ptr, H5C_cache_entry_t *target_ptr) node_ptr = H5SL_next(node_ptr); } - return (in_slist); -} /* H5C_entry_in_skip_list() */ + /* Set return value */ + ret_value = in_slist; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__entry_in_skip_list() */ #endif /* H5C_DO_SLIST_SANITY_CHECKS */ /*------------------------------------------------------------------------- diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 2bc6f36..55c7d03 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -1417,12 +1417,12 @@ if ( ( (cache_ptr)->index_size != \ #ifdef H5C_DO_SLIST_SANITY_CHECKS -#define ENTRY_IN_SLIST(cache_ptr, entry_ptr) \ - H5C_entry_in_skip_list((cache_ptr), (entry_ptr)) +#define H5C_ENTRY_IN_SLIST(cache_ptr, entry_ptr) \ + H5C__entry_in_skip_list((cache_ptr), (entry_ptr)) #else /* H5C_DO_SLIST_SANITY_CHECKS */ -#define ENTRY_IN_SLIST(cache_ptr, entry_ptr) FALSE +#define H5C_ENTRY_IN_SLIST(cache_ptr, entry_ptr) FALSE #endif /* H5C_DO_SLIST_SANITY_CHECKS */ @@ -1440,7 +1440,7 @@ if ( ( (cache_ptr)->index_size != \ HDassert( (entry_ptr)->size > 0 ); \ HDassert( H5F_addr_defined((entry_ptr)->addr) ); \ HDassert( !((entry_ptr)->in_slist) ); \ - HDassert( ! ENTRY_IN_SLIST((cache_ptr), (entry_ptr)) ); \ + HDassert( ! H5C_ENTRY_IN_SLIST((cache_ptr), (entry_ptr)) ); \ HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ @@ -1483,7 +1483,7 @@ if ( ( (cache_ptr)->index_size != \ \ HDassert( (entry_ptr) ); \ HDassert( (entry_ptr)->size > 0 ); \ - HDassert( ! ENTRY_IN_SLIST((cache_ptr), (entry_ptr)) ); \ + HDassert( ! H5C_ENTRY_IN_SLIST((cache_ptr), (entry_ptr)) ); \ HDassert( H5F_addr_defined((entry_ptr)->addr) ); \ HDassert( !((entry_ptr)->in_slist) ); \ HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ @@ -4628,6 +4628,10 @@ H5_DLL herr_t H5C__iter_tagged_entries(H5C_t *cache, haddr_t tag, hbool_t match_ H5_DLL herr_t H5C__tag_entry(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr); H5_DLL herr_t H5C__untag_entry(H5C_t *cache, H5C_cache_entry_t *entry); +#ifdef H5C_DO_SLIST_SANITY_CHECKS +H5_DLL hbool_t H5C__entry_in_skip_list(H5C_t *cache_ptr, H5C_cache_entry_t *target_ptr); +#endif + #ifdef H5C_DO_EXTREME_SANITY_CHECKS H5_DLL herr_t H5C__validate_lru_list(H5C_t *cache_ptr); H5_DLL herr_t H5C__validate_pinned_entry_list(H5C_t *cache_ptr); diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 855557d..a5330ce 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -2266,10 +2266,6 @@ H5_DLL herr_t H5C_cache_image_status(H5F_t *f, hbool_t *load_ci_ptr, hbool_t * H5_DLL hbool_t H5C_cache_image_pending(const H5C_t *cache_ptr); H5_DLL herr_t H5C_get_mdc_image_info(const H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len); -#ifdef H5C_DO_SLIST_SANITY_CHECKS -H5_DLL hbool_t H5C_entry_in_skip_list(H5C_t *cache_ptr, H5C_cache_entry_t *target_ptr); -#endif - /* Logging functions */ H5_DLL herr_t H5C_start_logging(H5C_t *cache); H5_DLL herr_t H5C_stop_logging(H5C_t *cache); -- cgit v0.12