farheapwalk
raw OCR
farheapwalk is used to "walk" through the far heap node by node.
Defined in header <alloc.h>
Syntax
#include <alloc.h>
int farheapwalk(struct farheapinfo *hi);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ |
Remarks
farheapwalk assumes the heap is correct. Use farheapcheck to verify the
| heap before using farheapwalk. _HEAPOK | is returned with the last block |
| on the heap. _HEAPEND | will be returned on the next call to farheapwalk. |
farheapwalk receives a pointer to a structure of type heapinfo (defined in alloc.h). For the first call to farheapwalk, set the hi.ptr field to null. farheapwalk returns with hi.ptr containing the address of the first block, hi.size holds the size of the block in bytes, hi.inuse is a flag that's set if the block is currently in use.
Return value
| HEAPEMPTY | is returned if there is no heap (value 1). |
| _HEAPOK | is returned if the heapinfo block contains valid data (value 2). |
| _HEAPEND | is returned if the end of the heap has been reached (value 5). |
See also
heapwalk#include<stdio.h>#include<alloc.h>fdefine_PTRS10#defineBYTES16intmain{structfarheapinfohi;charfar*array[NUM_PTRS];inti;for{i=0;i<NUM_PTRS;i++)array[i]=farmallocfarfree;hi.ptr=NULL;printf;printf;while==_HEAPOK)printf("%7u%s\n"hi.sizehi.in_use?"used"'free"
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/alloc.h/farheapwalk/
· short form /3.1/farheapwalk/