Skip to content

Commit

Permalink
Fix rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Knio committed Oct 26, 2016
1 parent 6319cf7 commit 12642a4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/edb.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ edb_map_close(edb *const db);
int
edb_init(edb *const db);

int
edb_resize(edb *db, u32 nblocks);

int edb_open(edb *const db, const char *const fname, int readonly, int overwrite) {
int err = 0;
Expand Down
2 changes: 0 additions & 2 deletions src/edb.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ extern "C" {
#define EDB_ERROR_FILE_SIZE (1002)
#define ERR_EDB_DB_SIZE_MAX (1003)

u32 edb_allocate_block(edb *db);
int edb_free_block(edb *db, const u32 block);
int edb_open(edb *db, const char* f_name, int readonly, int overwrite);
void edb_close(edb *db);
int edb_resize(edb *db, u32 nblocks);
Expand Down
13 changes: 10 additions & 3 deletions src/txn.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ int txn_begin(edb *db) {


int txn_allocate_block(edb* db, u32 *new_block) {
*new_block = edb_allocate_block(db);
int err = 0;
if ((err = edb_allocate_block(db, new_block))) {
goto err;
}
mem_hash_set(db->txn->blocks, *new_block, ALLOCATED);
return 0;

err:
return err;
}


Expand Down Expand Up @@ -87,7 +92,9 @@ int txn_modify_block(edb *db, u32 block, u32* new_block) {
return 0;
}
// copy on write allocation
*new_block = edb_allocate_block(db);
if ((err = edb_allocate_block(db, new_block))) {
goto err;
}
memcpy(BLOCK(db, *new_block), BLOCK(db, block), BLOCK_SIZE);
mem_hash_set(db->txn->blocks, *new_block, block);

Expand Down

0 comments on commit 12642a4

Please sign in to comment.