BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / kernel / file_systems / ramfs / BlockAllocatorAreaBucket.cpp
blob2fd04f78794597cfc763316a2859b98cde02cb53
1 // BlockAllocatorAreaBucket.cpp
3 #include "BlockAllocatorAreaBucket.h"
5 // constructor
6 BlockAllocator::AreaBucket::AreaBucket()
7 : fAreas(),
8 fIndex(-1),
9 fMinSize(0),
10 fMaxSize(0)
14 // destructor
15 BlockAllocator::AreaBucket::~AreaBucket()
17 while (Area *area = fAreas.First()) {
18 RemoveArea(area);
19 area->Delete();
23 // SanityCheck
24 bool
25 BlockAllocator::AreaBucket::SanityCheck(bool deep) const
27 // check area list
28 for (Area *area = GetFirstArea(); area; area = GetNextArea(area)) {
29 if (deep) {
30 if (!area->SanityCheck())
31 return false;
33 // bucket
34 if (area->GetBucket() != this) {
35 FATAL(("Area %p is in bucket %p, but thinks it is in bucket %p\n",
36 area, this, area->GetBucket()));
37 BA_PANIC("Wrong area bucket.");
38 return false;
40 // size
41 size_t areaSize = area->GetFreeBytes();
42 if (areaSize < fMinSize || areaSize >= fMaxSize) {
43 FATAL(("Area is in wrong bucket: free: %lu, min: %lu, max: %lu\n",
44 areaSize, fMinSize, fMaxSize));
45 BA_PANIC("Area in wrong bucket.");
46 return false;
49 return true;