fixed new const warnings from gcc

This commit is contained in:
Sears Russell 2008-09-24 06:40:34 +00:00
parent 021f28b8fd
commit 41cd975e91
4 changed files with 16 additions and 13 deletions

View file

@ -338,10 +338,10 @@ void allocationPolicyTransactionCompleted(allocationPolicy * ap, int xid) {
if(locks) {
const availablePage * next;
availablePage * next;
while(( next = RB_ENTRY(min)(locks) )) {
unlockAlloced(ap, xid, (availablePage*)next); // This is really inefficient. (We're wasting hashtable lookups. Also, an iterator would be faster.)
while(( next = (void*)RB_ENTRY(min)(locks) )) {
unlockAlloced(ap, xid, (next)); // This is really inefficient. (We're wasting hashtable lookups. Also, an iterator would be faster.)
}
LH_ENTRY(remove)(ap->xidAlloced, &xid, sizeof(int));
@ -352,9 +352,9 @@ void allocationPolicyTransactionCompleted(allocationPolicy * ap, int xid) {
locks = LH_ENTRY(find)(ap->xidDealloced, &xid, sizeof(int));
if(locks) {
const availablePage * next;
availablePage * next;
while(( next = RB_ENTRY(min)(locks) )) {
while(( next = (void*)RB_ENTRY(min)(locks) )) {
unlockDealloced(ap, xid, (availablePage*)next); // This is really inefficient. (We're wasting hashtable lookups. Also, an iterator would be faster.)
}

View file

@ -543,8 +543,8 @@ static LogEntry * readLogEntry() {
}
}
// entrySize = sizeofLogEntry(ret);
// assert(size == entrySize);
entrySize = sizeofLogEntry(ret);
assert(size == entrySize);
return ret;
}

View file

@ -229,6 +229,9 @@ struct Page_s {
static inline lsn_t* stasis_page_lsn_ptr(Page *p) {
return ((lsn_t*)(&(p->memAddr[PAGE_SIZE])))-1;
}
static inline const lsn_t* stasis_page_lsn_cptr(const Page *p) {
return ((const lsn_t*)(&(p->memAddr[PAGE_SIZE])))-1;
}
/**
Returns a pointer to the page's type. This information is stored with the LSN.
@ -243,7 +246,7 @@ static inline int* stasis_page_type_ptr(Page *p) {
return ((int*)stasis_page_lsn_ptr(p))-1;
}
static inline const int* stasis_page_type_cptr(const Page *p) {
return (const int*)stasis_page_type_ptr((Page*)p);
return ((const int*)stasis_page_lsn_cptr(p))-1;
}
/**
@ -389,11 +392,11 @@ stasis_page_int16_cptr_from_start(const Page *p, int count) {
static inline const int16_t*
stasis_page_int16_cptr_from_end(const Page *p, int count) {
return (const int16_t*)stasis_page_int16_ptr_from_end((Page*)p,count);
return ((int16_t*)stasis_page_type_cptr(p))-count;
}
static inline const int32_t*
stasis_page_int32_cptr_from_start(const Page *p, int count) {
return (const int32_t*)stasis_page_int32_ptr_from_start((Page*)p,count);
return ((const int32_t*)(p->memAddr))+count;
}
static inline const int32_t*

View file

@ -294,12 +294,12 @@ Suite * check_suite(void) {
tcase_set_timeout(tc, 0); // disable timeouts
/* Sub tests are added, one per line, here */
// tcase_add_test(tc, allocationPolicy_smokeTest);
// XXX this test might be flawed.
tcase_add_test(tc, allocationPolicy_smokeTest);
tcase_add_test(tc, allocationPolicy_randomTest);
/* --------------------------------------------- */
tcase_add_checked_fixture(tc, setup, teardown);