summaryrefslogtreecommitdiffstats
path: root/src/H5B.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5B.c')
-rw-r--r--src/H5B.c59
1 files changed, 30 insertions, 29 deletions
diff --git a/src/H5B.c b/src/H5B.c
index 71b9020..2a34fae 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -107,6 +107,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
@@ -436,8 +437,8 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx,
side = "LEFT";
else
side = "MIDDLE";
- fprintf(H5DEBUG(B), "H5B__split: %3u {%5.3f,%5.3f,%5.3f} %6s",
- shared->two_k, split_ratios[0], split_ratios[1], split_ratios[2], side);
+ HDfprintf(H5DEBUG(B), "H5B__split: %3u {%5.3f,%5.3f,%5.3f} %6s",
+ shared->two_k, split_ratios[0], split_ratios[1], split_ratios[2], side);
}
#endif
@@ -464,7 +465,7 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx,
nright = shared->two_k - nleft;
#ifdef H5B_DEBUG
if(H5DEBUG(B))
- fprintf(H5DEBUG(B), " split %3d/%-3d\n", nleft, nright);
+ HDfprintf(H5DEBUG(B), " split %3d/%-3d\n", nleft, nright);
#endif
/*
@@ -484,10 +485,10 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx,
*/
split_bt_ud->cache_flags = H5AC__DIRTIED_FLAG;
- HDmemcpy(split_bt_ud->bt->native,
+ H5MM_memcpy(split_bt_ud->bt->native,
bt_ud->bt->native + nleft * shared->type->sizeof_nkey,
(nright + 1) * shared->type->sizeof_nkey);
- HDmemcpy(split_bt_ud->bt->child,
+ H5MM_memcpy(split_bt_ud->bt->child,
&bt_ud->bt->child[nleft],
nright * sizeof(haddr_t));
@@ -612,9 +613,9 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
/* update left and right keys */
if(!lt_key_changed)
- HDmemcpy(lt_key, H5B_NKEY(bt_ud.bt,shared,0), type->sizeof_nkey);
+ H5MM_memcpy(lt_key, H5B_NKEY(bt_ud.bt,shared,0), type->sizeof_nkey);
if(!rt_key_changed)
- HDmemcpy(rt_key, H5B_NKEY(split_bt_ud.bt,shared,split_bt_ud.bt->nchildren), type->sizeof_nkey);
+ H5MM_memcpy(rt_key, H5B_NKEY(split_bt_ud.bt,shared,split_bt_ud.bt->nchildren), type->sizeof_nkey);
/*
* Copy the old root node to some other file location and make the new root
@@ -657,11 +658,11 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
new_root_bt->nchildren = 2;
new_root_bt->child[0] = bt_ud.addr;
- HDmemcpy(H5B_NKEY(new_root_bt, shared, 0), lt_key, shared->type->sizeof_nkey);
+ H5MM_memcpy(H5B_NKEY(new_root_bt, shared, 0), lt_key, shared->type->sizeof_nkey);
new_root_bt->child[1] = split_bt_ud.addr;
- HDmemcpy(H5B_NKEY(new_root_bt, shared, 1), md_key, shared->type->sizeof_nkey);
- HDmemcpy(H5B_NKEY(new_root_bt, shared, 2), rt_key, shared->type->sizeof_nkey);
+ H5MM_memcpy(H5B_NKEY(new_root_bt, shared, 1), md_key, shared->type->sizeof_nkey);
+ H5MM_memcpy(H5B_NKEY(new_root_bt, shared, 2), rt_key, shared->type->sizeof_nkey);
/* Insert the modified copy of the old root into the file again */
if(H5AC_insert_entry(f, H5AC_BT, addr, new_root_bt, H5AC__NO_FLAGS_SET) < 0)
@@ -726,9 +727,9 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx,
base = H5B_NKEY(bt, shared, (idx + 1));
if((idx + 1) == bt->nchildren) {
/* Make room for the new key */
- HDmemcpy(base + shared->type->sizeof_nkey, base,
+ H5MM_memcpy(base + shared->type->sizeof_nkey, base,
shared->type->sizeof_nkey); /* No overlap possible - memcpy() OK */
- HDmemcpy(base, md_key, shared->type->sizeof_nkey);
+ H5MM_memcpy(base, md_key, shared->type->sizeof_nkey);
/* The MD_KEY is the left key of the new node */
if(H5B_INS_RIGHT == anchor)
@@ -741,7 +742,7 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx,
/* Make room for the new key */
HDmemmove(base + shared->type->sizeof_nkey, base,
(bt->nchildren - idx) * shared->type->sizeof_nkey);
- HDmemcpy(base, md_key, shared->type->sizeof_nkey);
+ H5MM_memcpy(base, md_key, shared->type->sizeof_nkey);
/* The MD_KEY is the left key of the new node */
if(H5B_INS_RIGHT == anchor)
@@ -915,7 +916,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
* node. This node is not empty (handled above).
*/
my_ins = H5B_INS_LEFT;
- HDmemcpy(md_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey);
+ H5MM_memcpy(md_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey);
if((type->new_node)(f, H5B_INS_LEFT, H5B_NKEY(bt, shared, idx), udata,
md_key, &new_child_bt_ud.addr/*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node")
@@ -963,7 +964,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
*/
idx = bt->nchildren - 1;
my_ins = H5B_INS_RIGHT;
- HDmemcpy(md_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
+ H5MM_memcpy(md_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
if((type->new_node)(f, H5B_INS_RIGHT, md_key, udata,
H5B_NKEY(bt, shared, idx + 1), &new_child_bt_ud.addr/*out*/) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node")
@@ -1021,7 +1022,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
*lt_key_changed = FALSE;
} /* end if */
else
- HDmemcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey);
+ H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey);
} /* end if */
if(*rt_key_changed) {
bt_ud->cache_flags |= H5AC__DIRTIED_FLAG;
@@ -1031,7 +1032,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
*rt_key_changed = FALSE;
} /* end if */
else
- HDmemcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
+ H5MM_memcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
} /* end if */
/*
@@ -1080,7 +1081,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type,
* by the left and right node).
*/
if(split_bt_ud->bt) {
- HDmemcpy(md_key, H5B_NKEY(split_bt_ud->bt, shared, 0), type->sizeof_nkey);
+ H5MM_memcpy(md_key, H5B_NKEY(split_bt_ud->bt, shared, 0), type->sizeof_nkey);
ret_value = H5B_INS_RIGHT;
#ifdef H5B_DEBUG
/*
@@ -1339,7 +1340,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
/* Don't propagate change out of this B-tree node */
*lt_key_changed = FALSE;
else
- HDmemcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey);
+ H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey);
} /* end if */
if(*rt_key_changed) {
HDassert(type->critical_key == H5B_RIGHT);
@@ -1348,7 +1349,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
/* Don't propagate change out of this B-tree node */
*rt_key_changed = FALSE;
else
- HDmemcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
+ H5MM_memcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey);
} /* end if */
/*
@@ -1383,7 +1384,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
* in its left neighbor, but only if it is not the critical
* key for the right-most child of the left neighbor */
if(type->critical_key == H5B_LEFT)
- HDmemcpy(H5B_NKEY(sibling, shared, sibling->nchildren),
+ H5MM_memcpy(H5B_NKEY(sibling, shared, sibling->nchildren),
H5B_NKEY(bt, shared, 1), type->sizeof_nkey);
sibling->right = bt->right;
@@ -1400,7 +1401,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
* its right neighbor, but only if it is not the critical
* key for the left-most child of the right neighbor */
if(type->critical_key == H5B_RIGHT)
- HDmemcpy(H5B_NKEY(sibling, shared, 0),
+ H5MM_memcpy(H5B_NKEY(sibling, shared, 0),
H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
sibling->left = bt->left;
@@ -1442,7 +1443,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
/* Slide all keys down 1, update lt_key */
HDmemmove(H5B_NKEY(bt, shared, 0), H5B_NKEY(bt, shared, 1),
bt->nchildren * type->sizeof_nkey);
- HDmemcpy(lt_key, H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
+ H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
*lt_key_changed = TRUE;
} else
/* Slide all but the leftmost 2 keys down, leaving the leftmost
@@ -1471,7 +1472,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey);
else {
/* Just update rt_key */
- HDmemcpy(rt_key, H5B_NKEY(bt, shared, bt->nchildren - 1),
+ H5MM_memcpy(rt_key, H5B_NKEY(bt, shared, bt->nchildren - 1),
type->sizeof_nkey);
*rt_key_changed = TRUE;
} /* end else */
@@ -1516,7 +1517,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
if(NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->left, &cache_udata, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to protect node")
- HDmemcpy(H5B_NKEY(sibling, shared, sibling->nchildren),
+ H5MM_memcpy(H5B_NKEY(sibling, shared, sibling->nchildren),
H5B_NKEY(bt, shared, 0), type->sizeof_nkey);
if(H5AC_unprotect(f, H5AC_BT, bt->left, sibling, H5AC__DIRTIED_FLAG) < 0)
@@ -1531,7 +1532,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level,
if(NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->right, &cache_udata, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to protect node")
- HDmemcpy(H5B_NKEY(sibling, shared, 0),
+ H5MM_memcpy(H5B_NKEY(sibling, shared, 0),
H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey);
if(H5AC_unprotect(f, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0)
@@ -1811,7 +1812,7 @@ H5B__copy(const H5B_t *old_bt)
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node")
/* Copy the main structure */
- HDmemcpy(new_node, old_bt, sizeof(H5B_t));
+ H5MM_memcpy(new_node, old_bt, sizeof(H5B_t));
/* Reset cache info */
HDmemset(&new_node->cache_info, 0, sizeof(H5AC_info_t));
@@ -1821,8 +1822,8 @@ H5B__copy(const H5B_t *old_bt)
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node")
/* Copy the other structures */
- HDmemcpy(new_node->native, old_bt->native, shared->sizeof_keys);
- HDmemcpy(new_node->child, old_bt->child, (sizeof(haddr_t) * shared->two_k));
+ H5MM_memcpy(new_node->native, old_bt->native, shared->sizeof_keys);
+ H5MM_memcpy(new_node->child, old_bt->child, (sizeof(haddr_t) * shared->two_k));
/* Increment the ref-count on the raw page */
H5UC_INC(new_node->rc_shared);