AllocationBlock::Allocate() still had the 0xffff thing implemented, now

also the numBlocks parameter is ASSERTed - when compiled with DEBUG turned
off, BFS will enter the kernel debugger in this case (through the use of
the DIE() macro).
Same for AllocationBlock::Free() (but the 0xffff mode was already removed
there).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2053 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2002-11-21 20:32:54 +00:00
parent 98887c634e
commit 8a3e35d8c3

View File

@ -120,15 +120,11 @@ void
AllocationBlock::Allocate(uint16 start, uint16 numBlocks)
{
ASSERT(start < fNumBits);
ASSERT(start + numBlocks <= fNumBits);
if (numBlocks == 0xffff) {
// allocate all blocks after "start"
numBlocks = fNumBits - start;
} else if (start + numBlocks > fNumBits) {
if (start + numBlocks > fNumBits) {
FATAL(("Allocation::Allocate(): tried to allocate too many blocks: %u (numBlocks = %u)!\n", numBlocks, fNumBits));
DEBUGGER(("Allocation::Allocate(): tried to allocate too many blocks"));
numBlocks = fNumBits - start;
DIE(("Allocation::Allocate(): tried to allocate too many blocks"));
}
int32 block = start >> 5;
@ -155,12 +151,11 @@ void
AllocationBlock::Free(uint16 start, uint16 numBlocks)
{
ASSERT(start < fNumBits);
ASSERT(start + numBlocks <= fNumBits);
if (start + numBlocks > fNumBits) {
FATAL(("Allocation::Free(): tried to free too many blocks: %u (numBlocks = %u)!\n", numBlocks, fNumBits));
DEBUGGER(("Allocation::Free(): tried to free too many blocks"));
numBlocks = fNumBits - start;
DIE(("Allocation::Free(): tried to free too many blocks"));
}
int32 block = start >> 5;