diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-07-27 20:43:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-27 20:43:30 (GMT) |
commit | 1e91d96fa02466ffe451319bdac1005f84dc7993 (patch) | |
tree | 4de04ef502c313dfd766497b20235188761146c0 /src/H5HLcache.c | |
parent | 95e5349089b95dfb95f0f8ce2d6db1bc04ba6c82 (diff) | |
download | hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.zip hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.tar.gz hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.tar.bz2 |
Brings over most of the HD prefix removal (#3293)
Diffstat (limited to 'src/H5HLcache.c')
-rw-r--r-- | src/H5HLcache.c | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/src/H5HLcache.c b/src/H5HLcache.c index c04efb6..64cdf84 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -149,14 +149,14 @@ H5HL__hdr_deserialize(H5HL_t *heap, const uint8_t *image, size_t len, H5HL_cache FUNC_ENTER_PACKAGE - HDassert(heap); - HDassert(image); - HDassert(udata); + assert(heap); + assert(image); + assert(udata); /* Magic number */ if (H5_IS_BUFFER_OVERFLOW(image, H5_SIZEOF_MAGIC, p_end)) HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); - if (HDmemcmp(image, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + if (memcmp(image, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "bad local heap signature") image += H5_SIZEOF_MAGIC; @@ -218,8 +218,8 @@ H5HL__fl_deserialize(H5HL_t *heap) FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(heap); - HDassert(!heap->freelist); + assert(heap); + assert(!heap->freelist); /* Build free list */ free_block = heap->free_block; @@ -286,13 +286,13 @@ H5HL__fl_serialize(const H5HL_t *heap) FUNC_ENTER_PACKAGE_NOERR /* check arguments */ - HDassert(heap); + assert(heap); /* Serialize the free list into the heap data's image */ for (fl = heap->freelist; fl; fl = fl->next) { uint8_t *image; /* Pointer into raw data buffer */ - HDassert(fl->offset == H5HL_ALIGN(fl->offset)); + assert(fl->offset == H5HL_ALIGN(fl->offset)); image = heap->dblk_image + fl->offset; if (fl->next) @@ -327,7 +327,7 @@ H5HL__cache_prefix_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *im FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(image_len); + assert(image_len); /* Set the image length size */ *image_len = H5HL_SPEC_READ_SIZE; @@ -360,12 +360,12 @@ H5HL__cache_prefix_get_final_load_size(const void *_image, size_t image_len, voi FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(image); - HDassert(udata); - HDassert(actual_len); - HDassert(*actual_len == image_len); + assert(image); + assert(udata); + assert(actual_len); + assert(*actual_len == image_len); - HDmemset(&heap, 0, sizeof(H5HL_t)); + memset(&heap, 0, sizeof(H5HL_t)); /* Deserialize the heap's header */ if (H5HL__hdr_deserialize(&heap, (const uint8_t *)image, image_len, udata) < 0) @@ -410,14 +410,14 @@ H5HL__cache_prefix_deserialize(const void *_image, size_t len, void *_udata, hbo FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(image); - HDassert(len > 0); - HDassert(udata); - HDassert(udata->sizeof_size > 0); - HDassert(udata->sizeof_addr > 0); - HDassert(udata->sizeof_prfx > 0); - HDassert(H5F_addr_defined(udata->prfx_addr)); - HDassert(dirty); + assert(image); + assert(len > 0); + assert(udata); + assert(udata->sizeof_size > 0); + assert(udata->sizeof_addr > 0); + assert(udata->sizeof_prfx > 0); + assert(H5F_addr_defined(udata->prfx_addr)); + assert(dirty); /* Allocate space in memory for the heap */ if (NULL == (heap = H5HL__new(udata->sizeof_size, udata->sizeof_addr, udata->sizeof_prfx))) @@ -504,10 +504,10 @@ H5HL__cache_prefix_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(prfx); - HDassert(prfx->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(prfx->cache_info.type == H5AC_LHEAP_PRFX); - HDassert(image_len); + assert(prfx); + assert(prfx->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + assert(prfx->cache_info.type == H5AC_LHEAP_PRFX); + assert(image_len); /* Set the prefix's size */ *image_len = prfx->heap->prfx_size; @@ -548,24 +548,24 @@ H5HL__cache_prefix_serialize(const H5_ATTR_NDEBUG_UNUSED H5F_t *f, void *_image, FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(f); - HDassert(image); - HDassert(prfx); - HDassert(prfx->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(prfx->cache_info.type == H5AC_LHEAP_PRFX); - HDassert(H5F_addr_eq(prfx->cache_info.addr, prfx->heap->prfx_addr)); - HDassert(prfx->heap); + assert(f); + assert(image); + assert(prfx); + assert(prfx->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + assert(prfx->cache_info.type == H5AC_LHEAP_PRFX); + assert(H5F_addr_eq(prfx->cache_info.addr, prfx->heap->prfx_addr)); + assert(prfx->heap); /* Get the pointer to the heap */ heap = prfx->heap; - HDassert(heap); + assert(heap); #ifndef NDEBUG /* Compute the buffer size */ size_t buf_size = heap->prfx_size; /* expected size of the image buffer */ if (heap->single_cache_obj) buf_size += heap->dblk_size; - HDassert(len == buf_size); + assert(len == buf_size); #endif /* Update the free block value from the free list */ @@ -592,7 +592,7 @@ H5HL__cache_prefix_serialize(const H5_ATTR_NDEBUG_UNUSED H5F_t *f, void *_image, * the prefix and the data block due to alignment constraints. */ gap = heap->prfx_size - (size_t)(image - (uint8_t *)_image); - HDmemset(image, 0, gap); + memset(image, 0, gap); image += gap; } @@ -603,14 +603,14 @@ H5HL__cache_prefix_serialize(const H5_ATTR_NDEBUG_UNUSED H5F_t *f, void *_image, H5MM_memcpy(image, heap->dblk_image, heap->dblk_size); /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) + heap->dblk_size == len); + assert((size_t)(image - (uint8_t *)_image) + heap->dblk_size == len); } else { /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) <= len); + assert((size_t)(image - (uint8_t *)_image) <= len); /* Clear rest of local heap */ - HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); + memset(image, 0, len - (size_t)(image - (uint8_t *)_image)); } FUNC_LEAVE_NOAPI(SUCCEED) @@ -647,10 +647,10 @@ H5HL__cache_prefix_free_icr(void *_thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(prfx); - HDassert(prfx->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(prfx->cache_info.type == H5AC_LHEAP_PRFX); - HDassert(H5F_addr_eq(prfx->cache_info.addr, prfx->heap->prfx_addr)); + assert(prfx); + assert(prfx->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); + assert(prfx->cache_info.type == H5AC_LHEAP_PRFX); + assert(H5F_addr_eq(prfx->cache_info.addr, prfx->heap->prfx_addr)); /* Destroy local heap prefix */ if (H5HL__prfx_dest(prfx) < 0) @@ -683,9 +683,9 @@ H5HL__cache_datablock_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(heap); - HDassert(heap->dblk_size > 0); - HDassert(image_len); + assert(heap); + assert(heap->dblk_size > 0); + assert(image_len); /* Set the image length size */ *image_len = heap->dblk_size; @@ -718,13 +718,13 @@ H5HL__cache_datablock_deserialize(const void *image, size_t len, void *_udata, h FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(image); - HDassert(len > 0); - HDassert(heap); - HDassert(heap->dblk_size == len); - HDassert(!heap->single_cache_obj); - HDassert(NULL == heap->dblk); - HDassert(dirty); + assert(image); + assert(len > 0); + assert(heap); + assert(heap->dblk_size == len); + assert(!heap->single_cache_obj); + assert(NULL == heap->dblk); + assert(dirty); /* Allocate space in memory for the heap data block */ if (NULL == (dblk = H5HL__dblk_new(heap))) @@ -777,12 +777,12 @@ H5HL__cache_datablock_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(dblk); - HDassert(dblk->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(dblk->cache_info.type == H5AC_LHEAP_DBLK); - HDassert(dblk->heap); - HDassert(dblk->heap->dblk_size > 0); - HDassert(image_len); + assert(dblk); + assert(dblk->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + assert(dblk->cache_info.type == H5AC_LHEAP_DBLK); + assert(dblk->heap); + assert(dblk->heap->dblk_size > 0); + assert(image_len); *image_len = dblk->heap->dblk_size; @@ -813,15 +813,15 @@ H5HL__cache_datablock_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *imag FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(f); - HDassert(image); - HDassert(dblk); - HDassert(dblk->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(dblk->cache_info.type == H5AC_LHEAP_DBLK); - HDassert(dblk->heap); + assert(f); + assert(image); + assert(dblk); + assert(dblk->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + assert(dblk->cache_info.type == H5AC_LHEAP_DBLK); + assert(dblk->heap); heap = dblk->heap; - HDassert(heap->dblk_size == len); - HDassert(!heap->single_cache_obj); + assert(heap->dblk_size == len); + assert(!heap->single_cache_obj); /* Update the free block value from the free list */ heap->free_block = heap->freelist ? heap->freelist->offset : H5HL_FREE_NULL; @@ -858,7 +858,7 @@ H5HL__cache_datablock_notify(H5C_notify_action_t action, void *_thing) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dblk); + assert(dblk); switch (action) { case H5AC_NOTIFY_ACTION_AFTER_INSERT: @@ -867,8 +867,8 @@ H5HL__cache_datablock_notify(H5C_notify_action_t action, void *_thing) case H5AC_NOTIFY_ACTION_AFTER_LOAD: /* Sanity checks */ - HDassert(dblk->heap); - HDassert(dblk->heap->prfx); + assert(dblk->heap); + assert(dblk->heap->prfx); /* Pin the heap's prefix */ if (FAIL == H5AC_pin_protected_entry(dblk->heap->prfx)) @@ -887,8 +887,8 @@ H5HL__cache_datablock_notify(H5C_notify_action_t action, void *_thing) case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Sanity checks */ - HDassert(dblk->heap); - HDassert(dblk->heap->prfx); + assert(dblk->heap); + assert(dblk->heap->prfx); /* Unpin the local heap prefix */ if (FAIL == H5AC_unpin_entry(dblk->heap->prfx)) @@ -930,9 +930,9 @@ H5HL__cache_datablock_free_icr(void *_thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(dblk); - HDassert(dblk->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(dblk->cache_info.type == H5AC_LHEAP_DBLK); + assert(dblk); + assert(dblk->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); + assert(dblk->cache_info.type == H5AC_LHEAP_DBLK); /* Destroy the data block */ if (H5HL__dblk_dest(dblk) < 0) |