include: Add generic HeapAlloc() wrappers.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c1f5d39604
commit
d5a897f46f
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Wine heap memory allocation wrappers
|
||||
*
|
||||
* Copyright 2006 Jacek Caban for CodeWeavers
|
||||
* Copyright 2013, 2018 Michael Stefaniuc
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __WINE_WINE_HEAP_H
|
||||
#define __WINE_WINE_HEAP_H
|
||||
|
||||
#include <windef.h>
|
||||
|
||||
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(SIZE_T len)
|
||||
{
|
||||
return HeapAlloc(GetProcessHeap(), 0, len);
|
||||
}
|
||||
|
||||
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(SIZE_T len)
|
||||
{
|
||||
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
|
||||
}
|
||||
|
||||
static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, SIZE_T len)
|
||||
{
|
||||
if (!mem)
|
||||
return HeapAlloc(GetProcessHeap(), 0, len);
|
||||
return HeapReAlloc(GetProcessHeap(), 0, mem, len);
|
||||
}
|
||||
|
||||
static inline void heap_free(void *mem)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, mem);
|
||||
}
|
||||
|
||||
#endif /* __WINE_WINE_HEAP_H */
|
Loading…
Reference in New Issue