Commit aab744ac authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

refs #5671 add toku_memdup_dbt, it's cleaner


git-svn-id: file:///svn/toku/tokudb@50011 c7de825b-a66e-492c-adef-691d508d4ae1
parent 4258288e
......@@ -906,8 +906,7 @@ ftleaf_split(
LEAFENTRY CAST_FROM_VOIDP(le, lev);
uint32_t keylen;
void *key = le_key_and_len(le, &keylen);
toku_fill_dbt(splitk, toku_xmemdup(key, keylen), keylen);
splitk->flags = DB_DBT_MALLOC;
toku_memdup_dbt(splitk, key, keylen);
}
node->n_children = num_children_in_node;
......
......@@ -37,13 +37,19 @@ toku_destroy_dbt(DBT *dbt) {
DBT *
toku_fill_dbt(DBT *dbt, bytevec k, ITEMLEN len) {
dbt->flags = 0;
dbt->ulen = 0;
toku_init_dbt(dbt);
dbt->size=len;
dbt->data=(char*)k;
return dbt;
}
DBT *toku_memdup_dbt(DBT *dbt, const void *k, size_t len) {
toku_init_dbt_flags(dbt, DB_DBT_MALLOC);
dbt->size = len;
dbt->data = toku_xmemdup(k, len);
return dbt;
}
DBT *toku_copyref_dbt(DBT *dst, const DBT src) {
dst->flags = 0;
dst->ulen = 0;
......@@ -61,11 +67,7 @@ DBT *toku_copy_dbt(DBT *dst, const DBT &src) {
}
DBT *toku_clone_dbt(DBT *dst, const DBT &src) {
dst->flags = DB_DBT_MALLOC;
dst->ulen = 0;
dst->size = src.size;
dst->data = toku_xmemdup(src.data, src.size);
return dst;
return toku_memdup_dbt(dst, src.data, src.size);
}
void
......
......@@ -23,6 +23,8 @@ void toku_destroy_dbt(DBT *);
DBT *toku_fill_dbt(DBT *dbt, bytevec k, ITEMLEN len);
DBT *toku_memdup_dbt(DBT *dbt, const void *k, size_t len);
DBT *toku_copyref_dbt(DBT *dst, const DBT src);
DBT *toku_copy_dbt(DBT *dst, const DBT &src);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment