diff options
Diffstat (limited to 'src/H5B.c')
-rw-r--r-- | src/H5B.c | 248 |
1 files changed, 124 insertions, 124 deletions
@@ -211,9 +211,9 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *addr_p /*out /* * Check arguments. */ - HDassert(f); - HDassert(type); - HDassert(addr_p); + assert(f); + assert(type); + assert(addr_p); /* * Allocate file and memory data structures. @@ -229,7 +229,7 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *addr_p /*out HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree node buffer") H5UC_INC(bt->rc_shared); shared = (H5B_shared_t *)H5UC_GET_OBJ(bt->rc_shared); - HDassert(shared); + assert(shared); if (NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) || NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node") @@ -298,18 +298,18 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, hbool_t *found, void * /* * Check arguments. */ - HDassert(f); - HDassert(type); - HDassert(type->decode); - HDassert(type->cmp3); - HDassert(type->found); - HDassert(H5_addr_defined(addr)); + assert(f); + assert(type); + assert(type->decode); + assert(type->cmp3); + assert(type->found); + assert(H5_addr_defined(addr)); /* 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") shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + assert(shared); /* * Perform a binary search to locate the child which contains @@ -338,7 +338,7 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, hbool_t *found, void * /* * Follow the link to the subtree or to the data node. */ - HDassert(idx < bt->nchildren); + assert(idx < bt->nchildren); if (bt->level > 0) { if ((ret_value = H5B_find(f, type, bt->child[idx], found, udata)) < 0) @@ -392,19 +392,19 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx, void *udata, H5B_ins_ud_ /* * Check arguments. */ - HDassert(f); - HDassert(bt_ud); - HDassert(bt_ud->bt); - HDassert(H5_addr_defined(bt_ud->addr)); - HDassert(split_bt_ud); - HDassert(!split_bt_ud->bt); + assert(f); + assert(bt_ud); + assert(bt_ud->bt); + assert(H5_addr_defined(bt_ud->addr)); + assert(split_bt_ud); + assert(!split_bt_ud->bt); /* * Initialize variables. */ shared = (H5B_shared_t *)H5UC_GET_OBJ(bt_ud->bt->rc_shared); - HDassert(shared); - HDassert(bt_ud->bt->nchildren == shared->two_k); + assert(shared); + assert(bt_ud->bt->nchildren == shared->two_k); /* Get B-tree split ratios */ if (H5CX_get_btree_split_ratios(split_ratios) < 0) @@ -503,7 +503,7 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx, void *udata, H5B_ins_ud_ } /* end if */ bt_ud->bt->right = split_bt_ud->addr; - HDassert(bt_ud->cache_flags & H5AC__DIRTIED_FLAG); + assert(bt_ud->cache_flags & H5AC__DIRTIED_FLAG); done: if (ret_value < 0) { @@ -556,16 +556,16 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(f); - HDassert(type); - HDassert(type->sizeof_nkey <= sizeof _lt_key); - HDassert(H5_addr_defined(addr)); + assert(f); + assert(type); + assert(type->sizeof_nkey <= sizeof _lt_key); + assert(H5_addr_defined(addr)); /* 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") shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + assert(shared); /* Protect the root node */ cache_udata.f = f; @@ -583,12 +583,12 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) /* Check if the root node split */ if (H5B_INS_NOOP == my_ins) { /* The root node did not split - just return */ - HDassert(!split_bt_ud.bt); + assert(!split_bt_ud.bt); HGOTO_DONE(SUCCEED) } /* end if */ - HDassert(H5B_INS_RIGHT == my_ins); - HDassert(split_bt_ud.bt); - HDassert(H5_addr_defined(split_bt_ud.addr)); + assert(H5B_INS_RIGHT == my_ins); + assert(split_bt_ud.bt); + assert(H5_addr_defined(split_bt_ud.addr)); /* Get level of old root */ level = bt_ud.bt->level; @@ -694,12 +694,12 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, haddr_t child, H5 FUNC_ENTER_PACKAGE_NOERR - HDassert(bt); - HDassert(bt_flags); - HDassert(H5_addr_defined(child)); + assert(bt); + assert(bt_flags); + assert(H5_addr_defined(child)); shared = (H5B_shared_t *)H5UC_GET_OBJ(bt->rc_shared); - HDassert(shared); - HDassert(bt->nchildren < shared->two_k); + assert(shared); + assert(bt->nchildren < shared->two_k); /* Check for inserting right-most key into node (common when just appending * records to an unlimited dimension chunked dataset) @@ -791,22 +791,22 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 /* * Check arguments */ - HDassert(f); - HDassert(bt_ud); - HDassert(bt_ud->bt); - HDassert(H5_addr_defined(bt_ud->addr)); - HDassert(type); - HDassert(type->decode); - HDassert(type->cmp3); - HDassert(type->new_node); - HDassert(lt_key); - HDassert(lt_key_changed); - HDassert(rt_key); - HDassert(rt_key_changed); - HDassert(split_bt_ud); - HDassert(!split_bt_ud->bt); - HDassert(!H5_addr_defined(split_bt_ud->addr)); - HDassert(split_bt_ud->cache_flags == H5AC__NO_FLAGS_SET); + assert(f); + assert(bt_ud); + assert(bt_ud->bt); + assert(H5_addr_defined(bt_ud->addr)); + assert(type); + assert(type->decode); + assert(type->cmp3); + assert(type->new_node); + assert(lt_key); + assert(lt_key_changed); + assert(rt_key); + assert(rt_key_changed); + assert(split_bt_ud); + assert(!split_bt_ud->bt); + assert(!H5_addr_defined(split_bt_ud->addr)); + assert(split_bt_ud->cache_flags == H5AC__NO_FLAGS_SET); bt = bt_ud->bt; @@ -817,7 +817,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 if (NULL == (rc_shared = (type->get_shared)(f, udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, H5B_INS_ERROR, "can't retrieve B-tree's shared ref. count object") shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + assert(shared); /* * Use a binary search to find the child that will receive the new @@ -844,7 +844,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 * The value being inserted will be the only value in this tree. We * must necessarily be at level zero. */ - HDassert(0 == bt->level); + assert(0 == bt->level); if ((type->new_node)(f, H5B_INS_FIRST, H5B_NKEY(bt, shared, 0), udata, H5B_NKEY(bt, shared, 1), bt->child + 0 /*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, H5B_INS_ERROR, "unable to create leaf node") @@ -965,7 +965,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 * We couldn't figure out which branch to follow out of this node. THIS * IS A MAJOR PROBLEM THAT NEEDS TO BE FIXED --rpm. */ - HDassert("INTERNAL HDF5 ERROR (contact rpm)" && 0); + assert("INTERNAL HDF5 ERROR (contact rpm)" && 0); #ifdef NDEBUG HDabort(); #endif /* NDEBUG */ @@ -974,7 +974,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 /* * Follow a branch out of this node to another subtree. */ - HDassert(idx < bt->nchildren); + assert(idx < bt->nchildren); child_bt_ud.addr = bt->child[idx]; if (NULL == (child_bt_ud.bt = (H5B_t *)H5AC_protect(f, H5AC_BT, child_bt_ud.addr, &cache_udata, H5AC__NO_FLAGS_SET))) @@ -989,13 +989,13 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 /* * Follow a branch out of this node to a leaf node of some other type. */ - HDassert(idx < bt->nchildren); + assert(idx < bt->nchildren); if ((int)(my_ins = (type->insert)(f, bt->child[idx], H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &new_child_bt_ud.addr /*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert leaf node") } - HDassert((int)my_ins >= 0); + assert((int)my_ins >= 0); /* * Update the left and right keys of the current node. @@ -1003,8 +1003,8 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 if (*lt_key_changed) { bt_ud->cache_flags |= H5AC__DIRTIED_FLAG; if (idx > 0) { - HDassert(type->critical_key == H5B_LEFT); - HDassert(!(H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins)); + assert(type->critical_key == H5B_LEFT); + assert(!(H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins)); *lt_key_changed = FALSE; } /* end if */ else @@ -1013,8 +1013,8 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 if (*rt_key_changed) { bt_ud->cache_flags |= H5AC__DIRTIED_FLAG; if (idx + 1 < bt->nchildren) { - HDassert(type->critical_key == H5B_RIGHT); - HDassert(!(H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins)); + assert(type->critical_key == H5B_RIGHT); + assert(!(H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins)); *rt_key_changed = FALSE; } /* end if */ else @@ -1024,13 +1024,13 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 /* * Handle changes/additions to children */ - HDassert(!(bt->level == 0) != !(child_bt_ud.bt)); + assert(!(bt->level == 0) != !(child_bt_ud.bt)); if (H5B_INS_CHANGE == my_ins) { /* * The insertion simply changed the address for the child. */ - HDassert(!child_bt_ud.bt); - HDassert(bt->level == 0); + assert(!child_bt_ud.bt); + assert(bt->level == 0); bt->child[idx] = new_child_bt_ud.addr; bt_ud->cache_flags |= H5AC__DIRTIED_FLAG; } @@ -1077,7 +1077,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 * in the new node. */ cmp = (type->cmp2)(H5B_NKEY(bt, shared, bt->nchildren), udata, H5B_NKEY(split_bt_ud->bt, shared, 0)); - HDassert(0 == cmp); + assert(0 == cmp); #endif } /* end if */ else @@ -1124,17 +1124,17 @@ H5B__iterate_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr, H5B_operato /* * Check arguments. */ - HDassert(f); - HDassert(type); - HDassert(H5_addr_defined(addr)); - HDassert(op); - HDassert(udata); + assert(f); + assert(type); + assert(H5_addr_defined(addr)); + assert(op); + assert(udata); /* 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") shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + assert(shared); /* Protect the initial/current node */ cache_udata.f = f; @@ -1183,11 +1183,11 @@ H5B_iterate(H5F_t *f, const H5B_class_t *type, haddr_t addr, H5B_operator_t op, /* * Check arguments. */ - HDassert(f); - HDassert(type); - HDassert(H5_addr_defined(addr)); - HDassert(op); - HDassert(udata); + assert(f); + assert(type); + assert(H5_addr_defined(addr)); + assert(op); + assert(udata); /* Iterate over the B-tree records */ if ((ret_value = H5B__iterate_helper(f, type, addr, op, udata)) < 0) @@ -1236,20 +1236,20 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(H5_addr_defined(addr)); - HDassert(type); - HDassert(type->decode); - HDassert(type->cmp3); - HDassert(lt_key && lt_key_changed); - HDassert(udata); - HDassert(rt_key && rt_key_changed); + assert(f); + assert(H5_addr_defined(addr)); + assert(type); + assert(type->decode); + assert(type->cmp3); + assert(lt_key && lt_key_changed); + assert(udata); + assert(rt_key && rt_key_changed); /* Get shared info for B-tree */ if (NULL == (rc_shared = (type->get_shared)(f, udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, H5B_INS_ERROR, "can't retrieve B-tree's shared ref. count object") shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + assert(shared); /* * Perform a binary search to locate the child which contains the thing @@ -1276,7 +1276,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u * Follow the link to the subtree or to the data node. The return value * will be one of H5B_INS_ERROR, H5B_INS_NOOP, or H5B_INS_REMOVE. */ - HDassert(idx < bt->nchildren); + assert(idx < bt->nchildren); if (bt->level > 0) { /* We're at an internal node -- call recursively */ if ((int)(ret_value = @@ -1315,7 +1315,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u * our right key and indicate that it changed. */ if (*lt_key_changed) { - HDassert(type->critical_key == H5B_LEFT); + assert(type->critical_key == H5B_LEFT); bt_flags |= H5AC__DIRTIED_FLAG; if (idx > 0) @@ -1325,7 +1325,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey); } /* end if */ if (*rt_key_changed) { - HDassert(type->critical_key == H5B_RIGHT); + assert(type->critical_key == H5B_RIGHT); bt_flags |= H5AC__DIRTIED_FLAG; if (idx + 1 < bt->nchildren) /* Don't propagate change out of this B-tree node */ @@ -1342,8 +1342,8 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u /* Clients should not change keys when a node is removed. This function * will handle it as appropriate, based on the value of bt->critical_key */ - HDassert(!(*lt_key_changed)); - HDassert(!(*rt_key_changed)); + assert(!(*lt_key_changed)); + assert(!(*rt_key_changed)); if (1 == bt->nchildren) { /* @@ -1496,8 +1496,8 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u /* Patch keys in neighboring trees if necessary */ if (*lt_key_changed && H5_addr_defined(bt->left)) { - HDassert(type->critical_key == H5B_LEFT); - HDassert(level > 0); + assert(type->critical_key == H5B_LEFT); + assert(level > 0); /* Update the rightmost key in the left sibling */ if (NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->left, &cache_udata, H5AC__NO_FLAGS_SET))) @@ -1511,8 +1511,8 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u sibling = NULL; /* Make certain future references will be caught */ } /* end if */ else if (*rt_key_changed && H5_addr_defined(bt->right)) { - HDassert(type->critical_key == H5B_RIGHT); - HDassert(level > 0); + assert(type->critical_key == H5B_RIGHT); + assert(level > 0); /* Update the lefttmost key in the right sibling */ if (NULL == @@ -1563,10 +1563,10 @@ H5B_remove(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(f); - HDassert(type); - HDassert(type->sizeof_nkey <= sizeof _lt_key); - HDassert(H5_addr_defined(addr)); + assert(f); + assert(type); + assert(type->sizeof_nkey <= sizeof _lt_key); + assert(H5_addr_defined(addr)); /* The actual removal */ if (H5B_INS_ERROR == @@ -1606,15 +1606,15 @@ H5B_delete(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(f); - HDassert(type); - HDassert(H5_addr_defined(addr)); + assert(f); + assert(type); + assert(H5_addr_defined(addr)); /* 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") shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + assert(shared); /* Lock this B-tree node into memory for now */ cache_udata.f = f; @@ -1678,7 +1678,7 @@ H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey) /* * Check arguments. */ - HDassert(type); + assert(type); /* Allocate space for the shared structure */ if (NULL == (shared = H5FL_CALLOC(H5B_shared_t))) @@ -1690,12 +1690,12 @@ H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey) shared->sizeof_addr = H5F_SIZEOF_ADDR(f); shared->sizeof_len = H5F_SIZEOF_SIZE(f); shared->sizeof_rkey = sizeof_rkey; - HDassert(shared->sizeof_rkey); + assert(shared->sizeof_rkey); shared->sizeof_keys = (shared->two_k + 1) * type->sizeof_nkey; shared->sizeof_rnode = ((size_t)H5B_SIZEOF_HDR(f) + /*node header */ shared->two_k * H5F_SIZEOF_ADDR(f) + /*child pointers */ (shared->two_k + 1) * shared->sizeof_rkey); /*keys */ - HDassert(shared->sizeof_rnode); + assert(shared->sizeof_rnode); /* Allocate and clear shared buffers */ if (NULL == (shared->page = H5FL_BLK_MALLOC(page, shared->sizeof_rnode))) @@ -1782,9 +1782,9 @@ H5B__copy(const H5B_t *old_bt) /* * Check arguments. */ - HDassert(old_bt); + assert(old_bt); shared = (H5B_shared_t *)H5UC_GET_OBJ(old_bt->rc_shared); - HDassert(shared); + assert(shared); /* Allocate memory for the new H5B_t object */ if (NULL == (new_node = H5FL_MALLOC(H5B_t))) @@ -1852,18 +1852,18 @@ H5B__get_info_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr, const H5B_ /* * Check arguments. */ - HDassert(f); - HDassert(type); - HDassert(H5_addr_defined(addr)); - HDassert(info_udata); - HDassert(info_udata->bt_info); - HDassert(info_udata->udata); + assert(f); + assert(type); + assert(H5_addr_defined(addr)); + assert(info_udata); + assert(info_udata->bt_info); + assert(info_udata->udata); /* Get shared info for B-tree */ if (NULL == (rc_shared = (type->get_shared)(f, info_udata->udata))) HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + assert(shared); /* Get the raw node size for iteration */ sizeof_rnode = shared->sizeof_rnode; @@ -1950,11 +1950,11 @@ H5B_get_info(H5F_t *f, const H5B_class_t *type, haddr_t addr, H5B_info_t *bt_inf /* * Check arguments. */ - HDassert(f); - HDassert(type); - HDassert(bt_info); - HDassert(H5_addr_defined(addr)); - HDassert(udata); + assert(f); + assert(type); + assert(bt_info); + assert(H5_addr_defined(addr)); + assert(udata); /* Portably initialize B-tree info struct */ HDmemset(bt_info, 0, sizeof(*bt_info)); @@ -2002,8 +2002,8 @@ H5B_valid(H5F_t *f, const H5B_class_t *type, haddr_t addr) /* * Check arguments. */ - HDassert(f); - HDassert(type); + assert(f); + assert(type); if (!H5_addr_defined(addr)) HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, FAIL, "address is undefined") @@ -2011,7 +2011,7 @@ H5B_valid(H5F_t *f, const H5B_class_t *type, haddr_t addr) /* Get shared info for B-tree */ if (NULL == (rc_shared = (type->get_shared)(f, NULL))) HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") - HDassert(H5UC_GET_OBJ(rc_shared) != NULL); + assert(H5UC_GET_OBJ(rc_shared) != NULL); /* * Load the tree node. @@ -2049,8 +2049,8 @@ H5B__node_dest(H5B_t *bt) FUNC_ENTER_PACKAGE_NOERR /* check arguments */ - HDassert(bt); - HDassert(bt->rc_shared); + assert(bt); + assert(bt->rc_shared); bt->child = H5FL_SEQ_FREE(haddr_t, bt->child); bt->native = H5FL_BLK_FREE(native_block, bt->native); |