[5462] | 1 | /* $Id: heap.h,v 1.3 2001-04-03 18:53:05 sandervl Exp $ */
|
---|
[469] | 2 |
|
---|
| 3 | /*
|
---|
| 4 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
| 5 | * Win32 heap API functions for OS/2
|
---|
| 6 | * Copyright 1998 Sander van Leeuwen
|
---|
| 7 | */
|
---|
| 8 | #ifndef __HEAP_H__
|
---|
| 9 | #define __HEAP_H__
|
---|
| 10 |
|
---|
| 11 |
|
---|
| 12 | #include <winbase.h>
|
---|
| 13 |
|
---|
| 14 | #ifndef HEAP_NO_SERIALIZE
|
---|
| 15 | #define HEAP_NO_SERIALIZE 1
|
---|
| 16 | #endif
|
---|
| 17 |
|
---|
| 18 | #ifndef HEAP_ZERO_MEMORY
|
---|
| 19 | #define HEAP_ZERO_MEMORY 8
|
---|
| 20 | #endif
|
---|
| 21 |
|
---|
| 22 |
|
---|
| 23 | static HANDLE SegptrHeap;
|
---|
| 24 |
|
---|
| 25 | /* SEGPTR helper macros */
|
---|
| 26 |
|
---|
| 27 | #define SEGPTR_ALLOC(size) \
|
---|
| 28 | (HeapAlloc( SegptrHeap, 0, (size) ))
|
---|
| 29 | #define SEGPTR_NEW(type) \
|
---|
| 30 | ((type *)HeapAlloc( SegptrHeap, 0, sizeof(type) ))
|
---|
| 31 | #define SEGPTR_STRDUP(str) \
|
---|
| 32 | (HIWORD(str) ? HEAP_strdupA( SegptrHeap, 0, (str) ) : (LPSTR)(str))
|
---|
| 33 | #define SEGPTR_STRDUP_WtoA(str) \
|
---|
| 34 | (HIWORD(str) ? HEAP_strdupWtoA( SegptrHeap, 0, (str) ) : (LPSTR)(str))
|
---|
| 35 |
|
---|
| 36 | #if 0
|
---|
| 37 | /* define an inline function, a macro won't do */
|
---|
| 38 | static SEGPTR SEGPTR_Get(LPCVOID ptr)
|
---|
| 39 | {
|
---|
| 40 | return (HIWORD(ptr) ? HEAP_GetSegptr( SegptrHeap, 0, ptr ) : (SEGPTR)ptr);
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | #define SEGPTR_GET(ptr) SEGPTR_Get(ptr)
|
---|
| 44 | #define SEGPTR_FREE(ptr) \
|
---|
| 45 | (HIWORD(ptr) ? HeapFree( SegptrHeap, 0, (ptr) ) : 0)
|
---|
| 46 | #endif
|
---|
| 47 |
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 |
|
---|
| 51 | #endif
|
---|