From 814614b0bbca252ab6bda4f8d6a17613d7a177aa Mon Sep 17 00:00:00 2001 From: Rusty Sears Date: Wed, 30 Jan 2013 15:42:36 -0800 Subject: [PATCH] add casts; fix legacy fcn declaration --- src/stasis/operations/alloc.c | 16 ++++++++-------- src/stasis/page.c | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/stasis/operations/alloc.c b/src/stasis/operations/alloc.c index ecd91ab..60b5662 100644 --- a/src/stasis/operations/alloc.c +++ b/src/stasis/operations/alloc.c @@ -103,7 +103,7 @@ struct stasis_alloc_t { static int op_alloc(const LogEntry* e, Page* p) { assert(e->update.arg_size >= sizeof(alloc_arg)); - const alloc_arg* arg = stasis_log_entry_update_args_cptr(e); + const alloc_arg* arg = (const alloc_arg*)stasis_log_entry_update_args_cptr(e); recordid rid = { p->id, arg->slot, @@ -128,7 +128,7 @@ static int op_alloc(const LogEntry* e, Page* p) { static int op_dealloc(const LogEntry* e, Page* p) { assert(e->update.arg_size >= sizeof(alloc_arg)); - const alloc_arg* arg = stasis_log_entry_update_args_cptr(e); + const alloc_arg* arg = (const alloc_arg*)stasis_log_entry_update_args_cptr(e); recordid rid = { p->id, arg->slot, @@ -146,7 +146,7 @@ static int op_dealloc(const LogEntry* e, Page* p) { static int op_realloc(const LogEntry* e, Page* p) { assert(e->update.arg_size >= sizeof(alloc_arg)); - const alloc_arg* arg = stasis_log_entry_update_args_cptr(e); + const alloc_arg* arg = (const alloc_arg*)stasis_log_entry_update_args_cptr(e); recordid rid = { p->id, @@ -204,7 +204,7 @@ stasis_operation_impl stasis_op_impl_realloc(void) { } int stasis_alloc_callback(int xid, void * arg) { - stasis_alloc_t * alloc = arg; + stasis_alloc_t * alloc = (stasis_alloc_t*)arg; pthread_mutex_lock(&alloc->mut); stasis_allocation_policy_transaction_completed(alloc->allocPolicy, xid); pthread_mutex_unlock(&alloc->mut); @@ -221,7 +221,7 @@ stasis_alloc_t* stasis_alloc_init(stasis_transaction_table_t * tbl, stasis_alloc return alloc; } -static void stasis_alloc_register_old_regions(); +static void stasis_alloc_register_old_regions(stasis_alloc_t* alloc); void stasis_alloc_post_init(stasis_alloc_t * alloc) { stasis_alloc_register_old_regions(alloc); } @@ -278,7 +278,7 @@ static void stasis_alloc_reserve_new_region(stasis_alloc_t* alloc, int xid) { } recordid Talloc(int xid, unsigned long size) { - stasis_alloc_t* alloc = stasis_runtime_alloc_state(); + stasis_alloc_t* alloc = (stasis_alloc_t*)stasis_runtime_alloc_state(); short type; if(size >= BLOB_THRESHOLD_SIZE) { type = BLOB_SLOT; @@ -363,7 +363,7 @@ recordid Talloc(int xid, unsigned long size) { } recordid TallocFromPage(int xid, pageid_t page, unsigned long size) { - stasis_alloc_t* alloc = stasis_runtime_alloc_state(); + stasis_alloc_t* alloc = (stasis_alloc_t*)stasis_runtime_alloc_state(); short type; if(size >= BLOB_THRESHOLD_SIZE) { type = BLOB_SLOT; @@ -408,7 +408,7 @@ recordid TallocFromPage(int xid, pageid_t page, unsigned long size) { } void Tdealloc(int xid, recordid rid) { - stasis_alloc_t* alloc = stasis_runtime_alloc_state(); + stasis_alloc_t* alloc = (stasis_alloc_t*)stasis_runtime_alloc_state(); // @todo this needs to garbage collect empty storage regions. diff --git a/src/stasis/page.c b/src/stasis/page.c index 41ed405..cc1b8da 100644 --- a/src/stasis/page.c +++ b/src/stasis/page.c @@ -278,9 +278,9 @@ void stasis_uninitialized_page_loaded(int xid, Page * p) { if(xid == INVALID_XID) { xid_lsn = INVALID_LSN; } else { - xid_lsn = stasis_transaction_table_get(stasis_runtime_transaction_table(), xid)->prevLSN; + xid_lsn = stasis_transaction_table_get((stasis_transaction_table_t*)stasis_runtime_transaction_table(), xid)->prevLSN; } - lsn_t log_lsn = ((stasis_log_t*)stasis_log())->next_available_lsn(stasis_log()); + lsn_t log_lsn = ((stasis_log_t*)stasis_log())->next_available_lsn((stasis_log_t*)stasis_log()); // If this transaction has a prevLSN, prefer it. Otherwise, set the LSN to nextAvailableLSN - 1 p->LSN = *stasis_page_lsn_ptr(p) = (xid_lsn == INVALID_LSN) ? (log_lsn - 1) : xid_lsn; p->pageType = *stasis_page_type_ptr(p) = UNINITIALIZED_PAGE; @@ -337,7 +337,7 @@ typedef struct genericBlockImpl { @todo The block API should pass around xids. */ static const byte * blkFirst(block_t * b) { - genericBlockImpl * impl = b->impl; + genericBlockImpl * impl = (genericBlockImpl*)b->impl; impl->pos = stasis_record_first(-1, impl->p); if(! memcmp(&(impl->pos), &(NULLRID), sizeof(recordid))) { return 0; @@ -346,7 +346,7 @@ static const byte * blkFirst(block_t * b) { } } static const byte * blkNext(block_t * b) { - genericBlockImpl * impl = b->impl; + genericBlockImpl * impl = (genericBlockImpl*)b->impl; impl->pos = stasis_record_next(-1, impl->p, impl->pos); if(! memcmp(&(impl->pos), &NULLRID, sizeof(recordid))) { return 0; @@ -355,7 +355,7 @@ static const byte * blkNext(block_t * b) { } } static int blkSize(block_t * b) { - genericBlockImpl * impl = b->impl; + genericBlockImpl * impl = (genericBlockImpl*)b->impl; return stasis_record_type_to_size(impl->pos.size); } static void blkRelease(block_t * b) {