Skip to content

Commit

Permalink
Fixing build after hash table changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ayende committed Oct 2, 2020
1 parent 9596ebd commit 2da333a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
15 changes: 1 addition & 14 deletions ch17/code/hash.multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,6 @@ static result_t hash_multi_set_nested(
txn_t *tx, hash_val_t *set, uint64_t nested_hash_id) {
hash_val_t nested = {.hash_id = nested_hash_id, .key = set->val};
ensure(hash_set(tx, &nested, 0));
if (nested.hash_id_changed) {
uint64_t old_val = set->val;
set->val = nested.hash_id;
set->flags = hash_multi_nested;
ensure(hash_set(tx, set, 0));
set->val = old_val;
}
return success();
}

Expand Down Expand Up @@ -225,8 +218,7 @@ static result_t hash_multi_del_packed(txn_t *tx, hash_val_t *del,
if (in_place == false) {
existing->val = item.item_id;
ensure(hash_set(tx, existing, 0));
del->hash_id = existing->hash_id;
del->hash_id_changed = existing->hash_id_changed;
del->hash_id = existing->hash_id;
}
return success();
}
Expand Down Expand Up @@ -259,11 +251,6 @@ result_t hash_multi_del(
ensure(hash_del(tx, del));
return success();
}
if (existing.hash_id_changed) {
del->flags = hash_multi_nested;
del->val = existing.hash_id;
ensure(hash_set(tx, del, 0));
}
return success();
default:
failed(EINVAL, msg("Unknown flag type"));
Expand Down
13 changes: 13 additions & 0 deletions ch17/code/txn.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,3 +606,16 @@ result_t txn_register_cleanup_action(cleanup_callback_t **head,
return success();
}
// end::txn_register_cleanup_action[]

// tag::txn_alloc_temp[]
implementation_detail result_t txn_alloc_temp(
txn_t *tx, size_t min_size, void **buffer) {
if (tx->state->tmp.buffer.size < min_size) {
tx->state->tmp.buffer.size = next_power_of_two(min_size);
ensure(mem_realloc(
&tx->state->tmp.buffer.address, tx->state->tmp.buffer.size));
}
*buffer = tx->state->tmp.buffer.address;
return success();
}
// end::txn_alloc_temp[]

0 comments on commit 2da333a

Please sign in to comment.