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