| 251 | } |
| 252 | |
| 253 | omError_t omDoCheckBin(omBin bin, int normal_bin, char level, |
| 254 | omError_t report, OM_FLR_DECL) |
| 255 | { |
| 256 | omBin top_bin = bin; |
| 257 | |
| 258 | omCheckReturnError(!omIsKnownTopBin(bin, normal_bin), omError_UnknownBin); |
| 259 | if (! omIsStickyBin(bin)) |
| 260 | omCheckReturn(omCheckGList(bin->next, next, level, report, OM_FLR_VAL)); |
| 261 | |
| 262 | do |
| 263 | { |
| 264 | int where; |
| 265 | omBinPage page; |
| 266 | |
| 267 | if (bin->last_page == NULL || bin->current_page == om_ZeroPage) |
| 268 | { |
| 269 | omCheckReturnCorrupted(! (bin->current_page == om_ZeroPage && bin->last_page == NULL)); |
| 270 | continue; |
| 271 | } |
| 272 | omCheckReturn(omDoCheckBinPage(bin->current_page, normal_bin, level, report, OM_FLR_VAL)); |
| 273 | omCheckReturn(bin->current_page != bin->last_page && |
| 274 | omDoCheckBinPage(bin->last_page, normal_bin, level, report, OM_FLR_VAL)); |
| 275 | omCheckReturnCorrupted(bin->last_page->next != NULL); |
| 276 | |
| 277 | if (bin != top_bin) |
| 278 | { |
| 279 | omCheckReturnCorrupted(bin->sizeW != top_bin->sizeW || |
| 280 | bin->max_blocks != top_bin->max_blocks); |
| 281 | } |
| 282 | if (level <= 1) continue; |
| 283 | |
| 284 | if (! omIsStickyBin(bin)) |
| 285 | omCheckReturnCorrupted(omFindInGList(bin->next, next, sticky, bin->sticky)); |
| 286 | omCheckReturn(omCheckGList(bin->last_page, prev, level-1, report, OM_FLR_VAL)); |
| 287 | page = omGListLast(bin->last_page, prev); |
| 288 | omCheckReturn(omCheckGList(page, next, level-1, report, OM_FLR_VAL)); |
| 289 | omCheckReturnCorrupted(omGListLength(bin->last_page, prev) != omGListLength(page, next)); |
| 290 | |
| 291 | omCheckReturnCorrupted(! omIsOnGList(bin->last_page, prev, bin->current_page)); |
| 292 | |
| 293 | page = bin->last_page; |
| 294 | where = 1; |
| 295 | while (page != NULL) |
| 296 | { |
| 297 | omCheckReturnCorrupted(omGetTopBinOfPage(page) != top_bin); |
| 298 | omCheckReturn(page != bin->last_page && page != bin->current_page && |
| 299 | omDoCheckBinPage(page, normal_bin, level - 1, report, OM_FLR_VAL)); |
| 300 | |
| 301 | omCheckReturnCorrupted(page != bin->last_page && |
| 302 | (page->next == NULL || page->next->prev != page)); |
| 303 | omCheckReturnCorrupted(page->prev != NULL && page->prev->next != page); |
| 304 | |
| 305 | omCheckReturnCorrupted(omGetStickyOfPage(page) != bin->sticky && bin->sticky < SIZEOF_VOIDP); |
| 306 | omCheckReturnCorrupted(omGetBinOfPage(page) != bin); |
| 307 | |
| 308 | if (where == -1) |
| 309 | { |
| 310 | /* we are at the left of current_page, |
no test coverage detected