heapchecknode
raw OCR
Checks and verifies a single node on the heap.
Defined in header <alloc.h>
Syntax
#include <alloc.h>
int heapchecknode(void *node);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ |
Remarks
If a node has been freed and heapchecknode is called with a pointer to
| the freed block, heapchecknode can return BADNODE | rather than the |
| expected FREEENTRY. | This is because adjacent free blocks on the heap |
are merged, and the block in question no longer exists.
Return value
The return value is less than zero for an error and greater than zero for success. The return values and their meaning is as follows:
| _HEAPEMPTY | no heap (value 1). |
| _HEAPCORRUPT | heap has been corrupted (value -1). |
| _BADNODE | node could not be found (value -2). |
| _FREEENTRY | node is a free block (value 3). |
| _USEDENTRY | node is a used block (value 4). |
See also
farheapchecknode#include<stdio.h>#include<alloc.h>MefineNUM_PTRS10ttdefineNUM_BYTES16intmain{char*array[NUM_PTRSinti;forarray[i]=mallocfree;for{printf;switch)'{case_HEAPEMPTY:printf;break;case_HEAPCORRUPT:printf;break;case_BADNODE:printf;break;case_FREEENTRY:printf;break;case_USEDENTRY:printf;break;default:printf;break;}return0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/alloc.h/heapchecknode/
· short form /3.1/heapchecknode/