diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-06-28 14:31:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-28 14:31:56 (GMT) |
commit | 7a44581a84778a1346a2fd5b6cca7d9db905a321 (patch) | |
tree | 44ea9c2d1b471eb227698abe8499c34cfa6d47d2 /src/H5SM.c | |
parent | 622fcbd13881fbc58bbeaed3062583b759f5e864 (diff) | |
download | hdf5-7a44581a84778a1346a2fd5b6cca7d9db905a321.zip hdf5-7a44581a84778a1346a2fd5b6cca7d9db905a321.tar.gz hdf5-7a44581a84778a1346a2fd5b6cca7d9db905a321.tar.bz2 |
Rename HDassert() to assert() (#3191)
* Change HDassert to assert
* Fix bin/make_err
Diffstat (limited to 'src/H5SM.c')
-rw-r--r-- | src/H5SM.c | 204 |
1 files changed, 102 insertions, 102 deletions
@@ -120,9 +120,9 @@ H5SM_init(H5F_t *f, H5P_genplist_t *fc_plist, const H5O_loc_t *ext_loc) FUNC_ENTER_NOAPI_TAG(H5AC__SOHM_TAG, FAIL) - HDassert(f); + assert(f); /* File should not already have a SOHM table */ - HDassert(!H5_addr_defined(H5F_SOHM_ADDR(f))); + assert(!H5_addr_defined(H5F_SOHM_ADDR(f))); /* Set the ring type in the DXPL */ H5AC_set_ring(H5AC_RING_USER, &orig_ring); @@ -159,15 +159,15 @@ H5SM_init(H5F_t *f, H5P_genplist_t *fc_plist, const H5O_loc_t *ext_loc) /* Check that number of indexes in table and in superblock make sense. * Right now we just use one byte to hold the number of indexes. */ - HDassert(table->num_indexes < 256); + assert(table->num_indexes < 256); /* Check that list and btree cutoffs make sense. There can't be any * values greater than the list max but less than the btree min; the * list max has to be greater than or equal to one less than the btree * min. */ - HDassert(list_max + 1 >= btree_min); - HDassert(table->num_indexes > 0 && table->num_indexes <= H5O_SHMESG_MAX_NINDEXES); + assert(list_max + 1 >= btree_min); + assert(table->num_indexes > 0 && table->num_indexes <= H5O_SHMESG_MAX_NINDEXES); /* Allocate the SOHM indexes as an array. */ if (NULL == (table->indexes = @@ -404,8 +404,8 @@ H5SM_get_fheap_addr(H5F_t *f, unsigned type_id, haddr_t *fheap_addr) FUNC_ENTER_NOAPI_TAG(H5AC__SOHM_TAG, FAIL) /* Sanity checks */ - HDassert(f); - HDassert(fheap_addr); + assert(f); + assert(fheap_addr); /* Set up user data for callback */ cache_udata.f = f; @@ -453,9 +453,9 @@ H5SM__create_index(H5F_t *f, H5SM_index_header_t *header) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(header); - HDassert(header->index_addr == HADDR_UNDEF); - HDassert(header->btree_min <= header->list_max + 1); + assert(header); + assert(header->index_addr == HADDR_UNDEF); + assert(header->btree_min <= header->list_max + 1); /* In most cases, the index starts as a list */ if (header->list_max > 0) { @@ -515,7 +515,7 @@ H5SM__create_index(H5F_t *f, H5SM_index_header_t *header) /* Sanity check ID length */ if (H5HF_get_id_len(fheap, &fheap_id_len) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length") - HDassert(fheap_id_len == H5O_FHEAP_ID_LEN); + assert(fheap_id_len == H5O_FHEAP_ID_LEN); } #endif /* NDEBUG */ @@ -566,8 +566,8 @@ H5SM__delete_index(H5F_t *f, H5SM_index_header_t *header, hbool_t delete_heap) /* If the index list is in the cache, expunge it now */ if (index_status & H5AC_ES__IN_CACHE) { /* Sanity checks on index list */ - HDassert(!(index_status & H5AC_ES__IS_PINNED)); - HDassert(!(index_status & H5AC_ES__IS_PROTECTED)); + assert(!(index_status & H5AC_ES__IS_PINNED)); + assert(!(index_status & H5AC_ES__IS_PROTECTED)); /* Evict the index list from the metadata cache */ if (H5AC_expunge_entry(f, H5AC_SOHM_LIST, header->index_addr, H5AC__FREE_FILE_SPACE_FLAG) < 0) @@ -575,7 +575,7 @@ H5SM__delete_index(H5F_t *f, H5SM_index_header_t *header, hbool_t delete_heap) } /* end if */ } /* end if */ else { - HDassert(header->index_type == H5SM_BTREE); + assert(header->index_type == H5SM_BTREE); /* Delete the B-tree. */ if (H5B2_delete(f, header->index_addr, f, NULL, NULL) < 0) @@ -627,8 +627,8 @@ H5SM__create_list(H5F_t *f, H5SM_index_header_t *header) FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(header); + assert(f); + assert(header); num_entries = header->list_max; @@ -707,8 +707,8 @@ H5SM__convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header, H5SM_list_t * FUNC_ENTER_PACKAGE - HDassert(_list && *_list); - HDassert(header); + assert(_list && *_list); + assert(header); /* Get pointer to list of messages to convert */ list = *_list; @@ -810,16 +810,16 @@ H5SM__bt2_convert_to_list_op(const void *record, void *op_data) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(record); - HDassert(op_data); + assert(record); + assert(op_data); /* Get the message index, and increment the # of messages in list */ mesg_idx = list->header->num_messages++; - HDassert(list->header->num_messages <= list->header->list_max); + assert(list->header->num_messages <= list->header->list_max); /* Insert this message at the end of the list */ - HDassert(list->messages[mesg_idx].location == H5SM_NO_LOC); - HDassert(message->location != H5SM_NO_LOC); + assert(list->messages[mesg_idx].location == H5SM_NO_LOC); + assert(message->location != H5SM_NO_LOC); H5MM_memcpy(&(list->messages[mesg_idx]), message, sizeof(H5SM_sohm_t)); FUNC_LEAVE_NOAPI(SUCCEED) @@ -1139,19 +1139,19 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, unsigned type_id, if (((H5O_shared_t *)mesg)->type == H5O_SHARE_TYPE_HERE) *mesg_flags |= H5O_MSG_FLAG_SHAREABLE; else { - HDassert(((H5O_shared_t *)mesg)->type == H5O_SHARE_TYPE_SOHM); + assert(((H5O_shared_t *)mesg)->type == H5O_SHARE_TYPE_SOHM); *mesg_flags |= H5O_MSG_FLAG_SHARED; } /* end else */ } /* end if */ done: - HDassert((ret_value != TRUE) || ((H5O_shared_t *)mesg)->type == H5O_SHARE_TYPE_HERE || - ((H5O_shared_t *)mesg)->type == H5O_SHARE_TYPE_SOHM); + assert((ret_value != TRUE) || ((H5O_shared_t *)mesg)->type == H5O_SHARE_TYPE_HERE || + ((H5O_shared_t *)mesg)->type == H5O_SHARE_TYPE_SOHM); #ifndef NDEBUG /* If we previously deferred this operation, make sure the saved message * type is the same as the one we get here. */ if (defer_flags & H5SM_WAS_DEFERRED) - HDassert(deferred_type == ((H5O_shared_t *)mesg)->type); + assert(deferred_type == ((H5O_shared_t *)mesg)->type); #endif /* NDEBUG */ /* Release the master SOHM table */ @@ -1187,15 +1187,15 @@ H5SM__incr_ref(void *record, void *_op_data, hbool_t *changed) FUNC_ENTER_PACKAGE - HDassert(record); - HDassert(op_data); - HDassert(changed); + assert(record); + assert(op_data); + assert(changed); /* If the message was previously shared in an object header, share * it in the heap now. */ if (message->location == H5SM_IN_OH) { - HDassert(op_data->key && op_data->key->fheap); + assert(op_data->key && op_data->key->fheap); /* Put the message in the heap and record its new heap ID */ if (H5HF_insert(op_data->key->fheap, op_data->key->encoding_size, op_data->key->encoding, @@ -1206,7 +1206,7 @@ H5SM__incr_ref(void *record, void *_op_data, hbool_t *changed) message->u.heap_loc.ref_count = 2; } /* end if */ else { - HDassert(message->location == H5SM_IN_HEAP); + assert(message->location == H5SM_IN_HEAP); /* If it's already in the heap, just increment the ref count */ ++message->u.heap_loc.ref_count; } /* end else */ @@ -1273,9 +1273,9 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(header); - HDassert(header->index_type != H5SM_BADTYPE); - HDassert(cache_flags_ptr); + assert(header); + assert(header->index_type != H5SM_BADTYPE); + assert(cache_flags_ptr); /* Encode the message to be written */ if ((buf_size = H5O_msg_raw_size(f, type_id, TRUE, mesg)) == 0) @@ -1341,7 +1341,7 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t } /* end if */ else { /* If the message was already in the heap, increase its ref count */ - HDassert(list->messages[list_pos].location == H5SM_IN_HEAP); + assert(list->messages[list_pos].location == H5SM_IN_HEAP); ++(list->messages[list_pos].u.heap_loc.ref_count); } /* end else */ @@ -1353,7 +1353,7 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t } /* end if */ /* Index is a B-tree */ else { - HDassert(header->index_type == H5SM_BTREE); + assert(header->index_type == H5SM_BTREE); /* Open the index v2 B-tree */ if (NULL == (bt2 = H5B2_open(f, header->index_addr, f))) @@ -1487,13 +1487,13 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to find empty entry in list") } /* Insert message into list */ - HDassert(list->messages[empty_pos].location == H5SM_NO_LOC); - HDassert(key.message.location != H5SM_NO_LOC); + assert(list->messages[empty_pos].location == H5SM_NO_LOC); + assert(key.message.location != H5SM_NO_LOC); list->messages[empty_pos] = key.message; } /* end if */ /* Index is a B-tree */ else { - HDassert(header->index_type == H5SM_BTREE); + assert(header->index_type == H5SM_BTREE); /* Open the index v2 B-tree, if it isn't already */ if (NULL == bt2) { @@ -1570,9 +1570,9 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) FUNC_ENTER_NOAPI_TAG(H5AC__SOHM_TAG, FAIL) - HDassert(f); - HDassert(H5_addr_defined(H5F_SOHM_ADDR(f))); - HDassert(sh_mesg); + assert(f); + assert(H5_addr_defined(H5F_SOHM_ADDR(f))); + assert(sh_mesg); /* Get message type */ type_id = sh_mesg->msg_type_id; @@ -1665,9 +1665,9 @@ H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t * FUNC_ENTER_PACKAGE - HDassert(list); + assert(list); /* Both key and empty_pos can be NULL, but not both! */ - HDassert(key || empty_pos); + assert(key || empty_pos); /* Initialize empty_pos to an invalid value */ if (empty_pos) @@ -1730,9 +1730,9 @@ H5SM__decr_ref(void *record, void *op_data, hbool_t *changed) FUNC_ENTER_PACKAGE_NOERR - HDassert(record); - HDassert(op_data); - HDassert(changed); + assert(record); + assert(op_data); + assert(changed); /* Adjust the message's reference count if it's stored in the heap. * Messages stored in object headers always have refcounts of 1, @@ -1784,11 +1784,11 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, c FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(header); - HDassert(mesg); - HDassert(cache_flags); - HDassert(*encoded_mesg == NULL); + assert(f); + assert(header); + assert(mesg); + assert(cache_flags); + assert(*encoded_mesg == NULL); /* Get the message type for later */ type_id = mesg->msg_type_id; @@ -1851,7 +1851,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, c } /* end if */ else { /* Index is a B-tree */ - HDassert(header->index_type == H5SM_BTREE); + assert(header->index_type == H5SM_BTREE); /* Open the index v2 B-tree */ if (NULL == (bt2 = H5B2_open(f, header->index_addr, f))) @@ -1910,7 +1910,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, c HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list") list = NULL; - HDassert(fheap); + assert(fheap); if (H5HF_close(fheap) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap") fheap = NULL; @@ -1976,9 +1976,9 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist) FUNC_ENTER_NOAPI_TAG(H5AC__SOHM_TAG, FAIL) /* Sanity check */ - HDassert(ext_loc); - HDassert(f); - HDassert(fc_plist); + assert(ext_loc); + assert(f); + assert(fc_plist); /* Check for the extension having a 'shared message info' message */ if ((status = H5O_msg_exists(ext_loc, H5O_SHMESG_ID)) < 0) @@ -2003,8 +2003,8 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist) H5F_SET_SOHM_ADDR(f, sohm_table.addr); H5F_SET_SOHM_VERS(f, sohm_table.version); H5F_SET_SOHM_NINDEXES(f, sohm_table.nindexes); - HDassert(H5_addr_defined(H5F_SOHM_ADDR(f))); - HDassert(H5F_SOHM_NINDEXES(f) > 0 && H5F_SOHM_NINDEXES(f) <= H5O_SHMESG_MAX_NINDEXES); + assert(H5_addr_defined(H5F_SOHM_ADDR(f))); + assert(H5F_SOHM_NINDEXES(f) > 0 && H5F_SOHM_NINDEXES(f) <= H5O_SHMESG_MAX_NINDEXES); /* Set up user data for callback */ cache_udata.f = f; @@ -2028,8 +2028,8 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist) minsizes[u] = (unsigned)table->indexes[u].min_mesg_size; /* Sanity check */ - HDassert(sohm_l2b == table->indexes[u].list_max); - HDassert(sohm_b2l == table->indexes[u].btree_min); + assert(sohm_l2b == table->indexes[u].list_max); + assert(sohm_b2l == table->indexes[u].btree_min); /* Check for sharing attributes in this file, which means that creation * indices must be tracked on object header message in the file. @@ -2094,7 +2094,7 @@ H5SM_reconstitute(H5O_shared_t *sh_mesg, H5F_t *f, unsigned msg_type_id, H5O_fhe FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check args */ - HDassert(sh_mesg); + assert(sh_mesg); /* Set flag for shared message */ sh_mesg->type = H5O_SHARE_TYPE_SOHM; @@ -2128,8 +2128,8 @@ H5SM__get_refcount_bt2_cb(const void *_record, void *_op_data) /* * Check arguments. */ - HDassert(record); - HDassert(op_data); + assert(record); + assert(op_data); /* Make a copy of the record */ *op_data = *record; @@ -2168,9 +2168,9 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, hsize FUNC_ENTER_NOAPI_NOINIT_TAG(H5AC__SOHM_TAG) /* Sanity check */ - HDassert(f); - HDassert(sh_mesg); - HDassert(ref_count); + assert(f); + assert(sh_mesg); + assert(ref_count); /* Set up user data for callback */ tbl_cache_udata.f = f; @@ -2232,7 +2232,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, hsize hbool_t msg_exists; /* Whether the message exists in the v2 B-tree */ /* Index is a B-tree */ - HDassert(header->index_type == H5SM_BTREE); + assert(header->index_type == H5SM_BTREE); /* Open the index v2 B-tree */ if (NULL == (bt2 = H5B2_open(f, header->index_addr, f))) @@ -2247,7 +2247,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, hsize } /* end else */ /* Set the refcount for the message */ - HDassert(message.location == H5SM_IN_HEAP); + assert(message.location == H5SM_IN_HEAP); *ref_count = message.u.heap_loc.ref_count; done: @@ -2296,10 +2296,10 @@ H5SM__read_iter_op(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence, /* * Check arguments. */ - HDassert(oh); - HDassert(mesg); - HDassert(udata); - HDassert(NULL == udata->encoding_buf); + assert(oh); + assert(mesg); + assert(udata); + assert(NULL == udata->encoding_buf); /* Check the creation index for this message */ if (sequence == udata->idx) { @@ -2310,7 +2310,7 @@ H5SM__read_iter_op(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence, /* Get the message's encoded size */ udata->buf_size = mesg->raw_size; - HDassert(udata->buf_size); + assert(udata->buf_size); /* Allocate buffer to return the message in */ if (NULL == (udata->encoding_buf = H5MM_malloc(udata->buf_size))) @@ -2385,9 +2385,9 @@ H5SM__read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, H5O_t *open_oh FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(mesg); - HDassert(fheap); + assert(f); + assert(mesg); + assert(fheap); /* Set up user data for message iteration */ udata.file = f; @@ -2404,7 +2404,7 @@ H5SM__read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, H5O_t *open_oh H5O_mesg_operator_t op; /* Wrapper for operator */ type = H5O_msg_class_g[mesg->msg_type_id]; /* map the type ID to the actual type object */ - HDassert(type); + assert(type); /* Reset object location for operation */ if (H5O_loc_reset(&oloc) < 0) @@ -2431,14 +2431,14 @@ H5SM__read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, H5O_t *open_oh HGOTO_ERROR(H5E_SOHM, H5E_BADITER, FAIL, "unable to iterate over object header messages") } /* end if */ else { - HDassert(mesg->location == H5SM_IN_HEAP); + assert(mesg->location == H5SM_IN_HEAP); /* Copy the message from the heap */ if (H5HF_op(fheap, &(mesg->u.heap_loc.fheap_id), H5SM__read_mesg_fh_cb, &udata) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "can't read message from fractal heap.") } /* end else */ - HDassert(udata.encoding_buf); - HDassert(udata.buf_size); + assert(udata.encoding_buf); + assert(udata.buf_size); /* Record the returned values */ *encoded_mesg = udata.encoding_buf; @@ -2478,8 +2478,8 @@ H5SM__table_free(H5SM_master_table_t *table) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(table); - HDassert(table->indexes); + assert(table); + assert(table->indexes); table->indexes = H5FL_ARR_FREE(H5SM_index_header_t, table->indexes); @@ -2505,8 +2505,8 @@ H5SM__list_free(H5SM_list_t *list) { FUNC_ENTER_PACKAGE_NOERR - HDassert(list); - HDassert(list->messages); + assert(list); + assert(list->messages); list->messages = H5FL_ARR_FREE(H5SM_sohm_t, list->messages); @@ -2541,11 +2541,11 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, int fwi FUNC_ENTER_NOAPI_TAG(H5AC__SOHM_TAG, FAIL) - HDassert(f); - HDassert(table_addr != HADDR_UNDEF); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(table_addr != HADDR_UNDEF); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* If table_vers and num_indexes are UINT_MAX, replace them with values from * userblock @@ -2633,11 +2633,11 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, int fwidt FUNC_ENTER_NOAPI_TAG(H5AC__SOHM_TAG, FAIL) - HDassert(f); - HDassert(list_addr != HADDR_UNDEF); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(list_addr != HADDR_UNDEF); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* Set up user data for callback */ tbl_cache_udata.f = f; @@ -2679,7 +2679,7 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, int fwidt HDfprintf(stream, "%*s%-*s %08lu\n", indent + 3, "", fwidth, "Hash value:", (unsigned long)list->messages[x].hash); if (list->messages[x].location == H5SM_IN_HEAP) { - HDassert(fh); + assert(fh); HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth, "Location:", "in heap"); HDfprintf(stream, "%*s%-*s 0x%" PRIx64 "\n", indent + 3, "", fwidth, @@ -2740,10 +2740,10 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info) FUNC_ENTER_NOAPI_TAG(H5AC__SOHM_TAG, FAIL) /* Sanity check */ - HDassert(f); - HDassert(H5_addr_defined(H5F_SOHM_ADDR(f))); - HDassert(hdr_size); - HDassert(ih_info); + assert(f); + assert(H5_addr_defined(H5F_SOHM_ADDR(f))); + assert(hdr_size); + assert(ih_info); /* Set up user data for callback */ cache_udata.f = f; @@ -2775,7 +2775,7 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info) } /* end if */ } /* end if */ else { - HDassert(table->indexes[u].index_type == H5SM_LIST); + assert(table->indexes[u].index_type == H5SM_LIST); ih_info->index_size += table->indexes[u].list_size; } /* end else */ |