farheapfillfree
raw OCR
Fills the free blocks on the far heap with a constant value.
Defined in header <alloc.h>
Syntax
#include <alloc.h>
int farheapfillfree(unsigned int fillvalue);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ |
Return value
The return value is less than zero for an error and greater than zero for success.
| _HEAPEMPTY | is returned if there is no heap (value 1). |
| _HEAPOK | is returned if the heap is accurate (value 2). |
| _HEAPCORRUPT | is returned if the heap has been corrupted (value -1). |
See also
Example
#include <mem.h>
#include <stdio.h>
#include <alloc.h>
ttdefine NUM_PTRS 10
#define NUM_BYTES 16
int main(void)
{
char far *array [NUM_PTRS];
int i, ]', res;
for (i = 0; i < NUM_PTRS; i++)
if ((array[i] = (char far *) farmalloc(NUM_BYTES)) == NULL) {
printfC'No memory for allocation\n");
return 1;
}
for (i = 0; i < NUM_PTRS; i += 2)
farfree (array[i]);
if(farheapfillfree(l) < 0) {
printfC'Heap corrupted. \n");
return 1;
}
for (i = 1; i < NUM_PTRS; i += 2)
for (]■ = 0; j < NUM_BYTES; ]++)
array[i] [j] = 0;
res = farheapcheckfree(l) ;
if (res < 0)
switch(res) {
case _HEAPCORRUPT:
printfC'Heap corrupted. \n") ;
return 1;
case _BADVALUE:
printfC'Bad value in free space. \n");
return 1;
default:
printf ("Unknown error.\n");
return 1;
}
printfC'Test successful. \n") ;
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/alloc.h/farheapfillfree/
· short form /3.1/farheapfillfree/