removed dead code; added additional check for TpagedListInsert()

This commit is contained in:
Sears Russell 2008-10-04 07:18:25 +00:00
parent 132a567533
commit a20d28d369
2 changed files with 15 additions and 10 deletions

View file

@ -110,15 +110,12 @@ compensated_function int TpagedListFind(int xid, recordid list, const byte * key
free(dat);
return valueSize;
}
// if(dat->nextEntry) { // another entry on this page
rid.slot = dat->nextEntry;
free(dat); // }
rid.slot = dat->nextEntry; // rid.slot will be zero if this is the last entry
free(dat);
} else if (header.nextPage.size != -1) { // another page
rid.page = header.nextPage.page;
Tread(xid, header.nextPage, &header);
rid.slot = header.thisPage;
} else { // we've reached the end of the last page
rid.slot = 0;
}
}
} end_ret(compensation_error());

View file

@ -93,15 +93,23 @@ START_TEST(pagedListCheck) {
b.page = i+1;
b.slot = i+2;
b.size = i+3;
int ret = TpagedListInsert(xid, list, (byte*)&a, sizeof(int), (byte*)&b, sizeof(recordid));
int ret;
{
byte * t;
ret = TpagedListFind(xid, list, (byte*)&a, sizeof(int), &t);
assert(-1 == ret);
}
ret = TpagedListInsert(xid, list, (byte*)&a, sizeof(int), (byte*)&b, sizeof(recordid));
assert(!ret);
recordid * bb;
recordid ** bbb = &bb;
ret = TpagedListFind(xid, list, (byte*)&a, sizeof(int), (byte**)bbb);
assert(ret == sizeof(recordid));
assert(!memcmp(bb, &b, sizeof(recordid)));
}