/* * Project Odin Software License can be found in LICENSE.TXT * Win32 heap API functions for OS/2 * Copyright 1998 Sander van Leeuwen */ #ifndef __HEAP_H__ #define __HEAP_H__ #include #ifndef HEAP_NO_SERIALIZE #define HEAP_NO_SERIALIZE 1 #endif #ifndef HEAP_ZERO_MEMORY #define HEAP_ZERO_MEMORY 8 #endif static HANDLE SegptrHeap; /* SEGPTR helper macros */ #define SEGPTR_ALLOC(size) \ (HeapAlloc( SegptrHeap, 0, (size) )) #define SEGPTR_NEW(type) \ ((type *)HeapAlloc( SegptrHeap, 0, sizeof(type) )) #define SEGPTR_STRDUP(str) \ (HIWORD(str) ? HEAP_strdupA( SegptrHeap, 0, (str) ) : (LPSTR)(str)) #define SEGPTR_STRDUP_WtoA(str) \ (HIWORD(str) ? HEAP_strdupWtoA( SegptrHeap, 0, (str) ) : (LPSTR)(str)) #if 0 /* define an inline function, a macro won't do */ static SEGPTR SEGPTR_Get(LPCVOID ptr) { return (HIWORD(ptr) ? HEAP_GetSegptr( SegptrHeap, 0, ptr ) : (SEGPTR)ptr); } #define SEGPTR_GET(ptr) SEGPTR_Get(ptr) #define SEGPTR_FREE(ptr) \ (HIWORD(ptr) ? HeapFree( SegptrHeap, 0, (ptr) ) : 0) #endif #endif