MCPcopy Create free account
hub / github.com/Singular/Singular / omDoCheckBinPage

Function omDoCheckBinPage

omalloc/omDebugCheck.c:336–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334
335
336static omError_t omDoCheckBinPage(omBinPage page, int normal_page, int level,
337 omError_t report, OM_FLR_DECL)
338{
339 omBin bin;
340
341 omCheckReturn(omCheckPtr(page, report, OM_FLR_VAL));
342 omCheckReturnCorrupted(! omIsAddrPageAligned(page));
343
344 omCheckReturn(omCheckPtr(page->region, report, OM_FLR_VAL));
345 omCheckReturnCorrupted(level > 1 && omFindRegionOfAddr(page) != page->region);
346
347
348#ifdef OM_HAVE_TRACK
349 if (! normal_page)
350 {
351 omCheckReturnCorrupted(! omIsSetTrackOfUsedBlocks(page->used_blocks));
352 }
353 else
354#endif
355 omAssume(normal_page);
356
357 bin = omGetTopBinOfPage(page);
358 if (bin->max_blocks > 1)
359 {
360 omCheckReturnCorrupted(omGetUsedBlocksOfPage(page) > bin->max_blocks - 1);
361 omCheckReturnCorrupted(omGetUsedBlocksOfPage(page) == bin->max_blocks - 1 &&
362 page->current != NULL);
363 omCheckReturnCorrupted(omGetUsedBlocksOfPage(page) < 0);
364 }
365 else
366 {
367 omCheckReturnCorrupted(omGetUsedBlocksOfPage(page) != 0);
368 }
369
370 omCheckReturn(omCheckList(page->current, level, report, OM_FLR_VAL));
371
372 if (level > 1)
373 {
374 void* current = page->current;
375
376 omCheckReturnCorrupted(current != NULL &&
377 omListLength(current) != bin->max_blocks - omGetUsedBlocksOfPage(page) - 1);
378
379 while (current != NULL)
380 {
381 omCheckReturnCorrupted(omGetPageOfAddr(current) != page);
382
383 omCheckReturnCorrupted( ( ( (unsigned long) current)
384 - ((unsigned long) page)
385 - SIZEOF_OM_BIN_PAGE_HEADER)
386 % (bin->sizeW * SIZEOF_LONG)
387 != 0);
388 current = *((void**) current);
389 }
390 }
391 return omError_NoError;
392}
393

Callers 1

omDoCheckBinFunction · 0.85

Calls 2

omCheckPtrFunction · 0.85
omFindRegionOfAddrFunction · 0.85

Tested by

no test coverage detected