Commit fd1b9afc authored by Brendan Shanks's avatar Brendan Shanks Committed by Alexandre Julliard

include: Add __WINE_MALLOC attribute and use it for allocation functions.

parent 0c856978
......@@ -1656,10 +1656,10 @@ BOOLEAN WINAPI ExAcquireResourceExclusiveLite(ERESOURCE*,BOOLEAN);
BOOLEAN WINAPI ExAcquireResourceSharedLite(ERESOURCE*,BOOLEAN);
BOOLEAN WINAPI ExAcquireSharedStarveExclusive(ERESOURCE*,BOOLEAN);
BOOLEAN WINAPI ExAcquireSharedWaitForExclusive(ERESOURCE*,BOOLEAN);
PVOID WINAPI ExAllocatePool(POOL_TYPE,SIZE_T) __WINE_ALLOC_SIZE(2);
PVOID WINAPI ExAllocatePoolWithQuota(POOL_TYPE,SIZE_T) __WINE_ALLOC_SIZE(2);
PVOID WINAPI ExAllocatePoolWithTag(POOL_TYPE,SIZE_T,ULONG) __WINE_ALLOC_SIZE(2);
PVOID WINAPI ExAllocatePoolWithQuotaTag(POOL_TYPE,SIZE_T,ULONG) __WINE_ALLOC_SIZE(2);
PVOID WINAPI ExAllocatePool(POOL_TYPE,SIZE_T) __WINE_ALLOC_SIZE(2) __WINE_MALLOC;
PVOID WINAPI ExAllocatePoolWithQuota(POOL_TYPE,SIZE_T) __WINE_ALLOC_SIZE(2) __WINE_MALLOC;
PVOID WINAPI ExAllocatePoolWithTag(POOL_TYPE,SIZE_T,ULONG) __WINE_ALLOC_SIZE(2) __WINE_MALLOC;
PVOID WINAPI ExAllocatePoolWithQuotaTag(POOL_TYPE,SIZE_T,ULONG) __WINE_ALLOC_SIZE(2) __WINE_MALLOC;
void WINAPI ExDeleteNPagedLookasideList(PNPAGED_LOOKASIDE_LIST);
void WINAPI ExDeletePagedLookasideList(PPAGED_LOOKASIDE_LIST);
NTSTATUS WINAPI ExDeleteResourceLite(ERESOURCE*);
......@@ -1791,8 +1791,8 @@ BOOLEAN WINAPI KeSignalCallDpcSynchronize(void*);
NTSTATUS WINAPI KeWaitForMultipleObjects(ULONG,void*[],WAIT_TYPE,KWAIT_REASON,KPROCESSOR_MODE,BOOLEAN,LARGE_INTEGER*,KWAIT_BLOCK*);
NTSTATUS WINAPI KeWaitForSingleObject(void*,KWAIT_REASON,KPROCESSOR_MODE,BOOLEAN,LARGE_INTEGER*);
PVOID WINAPI MmAllocateContiguousMemory(SIZE_T,PHYSICAL_ADDRESS) __WINE_ALLOC_SIZE(1);
PVOID WINAPI MmAllocateNonCachedMemory(SIZE_T) __WINE_ALLOC_SIZE(1);
PVOID WINAPI MmAllocateContiguousMemory(SIZE_T,PHYSICAL_ADDRESS) __WINE_ALLOC_SIZE(1) __WINE_MALLOC;
PVOID WINAPI MmAllocateNonCachedMemory(SIZE_T) __WINE_ALLOC_SIZE(1) __WINE_MALLOC;
PMDL WINAPI MmAllocatePagesForMdl(PHYSICAL_ADDRESS,PHYSICAL_ADDRESS,PHYSICAL_ADDRESS,SIZE_T);
void WINAPI MmBuildMdlForNonPagedPool(MDL*);
NTSTATUS WINAPI MmCopyVirtualMemory(PEPROCESS,void*,PEPROCESS,void*,SIZE_T,KPROCESSOR_MODE,SIZE_T*);
......
......@@ -317,7 +317,7 @@ HRESULT WINAPI CoGetInstanceFromFile(COSERVERINFO* pServerInfo, CLSID* pClsid, I
HRESULT WINAPI CoGetInstanceFromIStorage(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, DWORD dwClsCtx, IStorage* pstg, DWORD dwCount, MULTI_QI* pResults);
HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC* lpMalloc);
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size) __WINE_ALLOC_SIZE(1);
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size) __WINE_ALLOC_SIZE(1) __WINE_MALLOC;
void WINAPI CoTaskMemFree(LPVOID ptr);
LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, SIZE_T size) __WINE_ALLOC_SIZE(2);
......
......@@ -38,9 +38,9 @@ DEFINE_OLEGUID(IID_StdOle, 0x00020430,0,0);
ULONG WINAPI OaBuildVersion(void);
/* BSTR functions */
BSTR WINAPI SysAllocString(const OLECHAR*);
BSTR WINAPI SysAllocStringByteLen(LPCSTR,UINT);
BSTR WINAPI SysAllocStringLen(const OLECHAR*,UINT);
BSTR WINAPI SysAllocString(const OLECHAR*) __WINE_MALLOC;
BSTR WINAPI SysAllocStringByteLen(LPCSTR,UINT) __WINE_MALLOC;
BSTR WINAPI SysAllocStringLen(const OLECHAR*,UINT) __WINE_MALLOC;
void WINAPI SysFreeString(BSTR);
INT WINAPI SysReAllocString(LPBSTR,const OLECHAR*);
int WINAPI SysReAllocStringLen(BSTR*,const OLECHAR*,UINT);
......
......@@ -658,7 +658,7 @@ RPCRTAPI LONG RPC_ENTRY
NdrDcomAsyncStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, DWORD * pdwStubPhase );
RPCRTAPI void* RPC_ENTRY
NdrAllocate( PMIDL_STUB_MESSAGE pStubMsg, SIZE_T Len ) __WINE_ALLOC_SIZE(2);
NdrAllocate( PMIDL_STUB_MESSAGE pStubMsg, SIZE_T Len ) __WINE_ALLOC_SIZE(2) __WINE_MALLOC;
RPCRTAPI void RPC_ENTRY
NdrClearOutParameters( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, void *ArgAddr );
......@@ -668,7 +668,7 @@ RPCRTAPI RPC_STATUS RPC_ENTRY
ULONG *pFaultStatus, RPC_STATUS Status_ );
RPCRTAPI void* RPC_ENTRY
NdrOleAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1);
NdrOleAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1) __WINE_MALLOC;
RPCRTAPI void RPC_ENTRY
NdrOleFree( void* NodeToFree );
......@@ -729,11 +729,11 @@ RPCRTAPI void RPC_ENTRY
RPCRTAPI void RPC_ENTRY
NdrRpcSmSetClientToOsf( PMIDL_STUB_MESSAGE pMessage );
RPCRTAPI void * RPC_ENTRY
NdrRpcSmClientAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1);
NdrRpcSmClientAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1) __WINE_MALLOC;
RPCRTAPI void RPC_ENTRY
NdrRpcSmClientFree( void *NodeToFree );
RPCRTAPI void * RPC_ENTRY
NdrRpcSsDefaultAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1);
NdrRpcSsDefaultAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1) __WINE_MALLOC;
RPCRTAPI void RPC_ENTRY
NdrRpcSsDefaultFree( void *NodeToFree );
......
......@@ -2350,7 +2350,7 @@ WINBASEAPI BOOL WINAPI GetXStateFeaturesMask(CONTEXT*,DWORD64*);
WINBASEAPI ATOM WINAPI GlobalAddAtomA(LPCSTR);
WINBASEAPI ATOM WINAPI GlobalAddAtomW(LPCWSTR);
#define GlobalAddAtom WINELIB_NAME_AW(GlobalAddAtom)
WINBASEAPI HGLOBAL WINAPI GlobalAlloc(UINT,SIZE_T) __WINE_ALLOC_SIZE(2);
WINBASEAPI HGLOBAL WINAPI GlobalAlloc(UINT,SIZE_T) __WINE_ALLOC_SIZE(2) __WINE_MALLOC;
WINBASEAPI SIZE_T WINAPI GlobalCompact(DWORD);
WINBASEAPI ATOM WINAPI GlobalDeleteAtom(ATOM);
WINBASEAPI ATOM WINAPI GlobalFindAtomA(LPCSTR);
......@@ -2373,7 +2373,7 @@ WINBASEAPI BOOL WINAPI GlobalUnlock(HGLOBAL);
WINBASEAPI BOOL WINAPI GlobalUnWire(HGLOBAL);
WINBASEAPI LPVOID WINAPI GlobalWire(HGLOBAL);
#define HasOverlappedIoCompleted(lpOverlapped) ((lpOverlapped)->Internal != STATUS_PENDING)
WINBASEAPI LPVOID WINAPI HeapAlloc(HANDLE,DWORD,SIZE_T) __WINE_ALLOC_SIZE(3);
WINBASEAPI LPVOID WINAPI HeapAlloc(HANDLE,DWORD,SIZE_T) __WINE_ALLOC_SIZE(3) __WINE_MALLOC;
WINBASEAPI SIZE_T WINAPI HeapCompact(HANDLE,DWORD);
WINBASEAPI HANDLE WINAPI HeapCreate(DWORD,SIZE_T,SIZE_T);
WINBASEAPI BOOL WINAPI HeapDestroy(HANDLE);
......@@ -2440,7 +2440,7 @@ WINBASEAPI HMODULE WINAPI LoadLibraryExW(LPCWSTR,HANDLE,DWORD);
WINBASEAPI DWORD WINAPI LoadModule(LPCSTR,LPVOID);
WINBASEAPI HMODULE WINAPI LoadPackagedLibrary(LPCWSTR,DWORD);
WINBASEAPI HGLOBAL WINAPI LoadResource(HMODULE,HRSRC);
WINBASEAPI HLOCAL WINAPI LocalAlloc(UINT,SIZE_T) __WINE_ALLOC_SIZE(2);
WINBASEAPI HLOCAL WINAPI LocalAlloc(UINT,SIZE_T) __WINE_ALLOC_SIZE(2) __WINE_MALLOC;
WINBASEAPI SIZE_T WINAPI LocalCompact(UINT);
WINBASEAPI UINT WINAPI LocalFlags(HLOCAL);
WINBASEAPI HLOCAL WINAPI LocalFree(HLOCAL);
......
......@@ -4043,7 +4043,7 @@ WINADVAPI BOOL WINAPI CryptVerifySignatureW (HCRYPTHASH, const BYTE *, DWORD, HC
#define CryptVerifySignature WINELIB_NAME_AW(CryptVerifySignature)
/* crypt32.dll functions */
LPVOID WINAPI CryptMemAlloc(ULONG cbSize) __WINE_ALLOC_SIZE(1);
LPVOID WINAPI CryptMemAlloc(ULONG cbSize) __WINE_ALLOC_SIZE(1) __WINE_MALLOC;
LPVOID WINAPI CryptMemRealloc(LPVOID pv, ULONG cbSize) __WINE_ALLOC_SIZE(2);
VOID WINAPI CryptMemFree(LPVOID pv);
......
......@@ -24,12 +24,12 @@
#include <winbase.h>
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(SIZE_T len)
static inline void * __WINE_ALLOC_SIZE(1) __WINE_MALLOC heap_alloc(SIZE_T len)
{
return HeapAlloc(GetProcessHeap(), 0, len);
}
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(SIZE_T len)
static inline void * __WINE_ALLOC_SIZE(1) __WINE_MALLOC heap_alloc_zero(SIZE_T len)
{
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
}
......@@ -46,7 +46,7 @@ static inline void heap_free(void *mem)
HeapFree(GetProcessHeap(), 0, mem);
}
static inline void * __WINE_ALLOC_SIZE(1,2) heap_calloc(SIZE_T count, SIZE_T size)
static inline void * __WINE_ALLOC_SIZE(1,2) __WINE_MALLOC heap_calloc(SIZE_T count, SIZE_T size)
{
SIZE_T len = count * size;
......
......@@ -204,6 +204,12 @@ extern "C" {
#define __WINE_ALLOC_SIZE(...)
#endif
#if defined(__GNUC__) && (__GNUC__ > 2)
#define __WINE_MALLOC __attribute__((malloc))
#else
#define __WINE_MALLOC
#endif
/* Anonymous union/struct handling */
#ifndef NONAMELESSSTRUCT
......
......@@ -4200,7 +4200,7 @@ NTSYSAPI PVOID WINAPI RtlAddVectoredExceptionHandler(ULONG,PVECTORED_EXCEPTI
NTSYSAPI NTSTATUS WINAPI RtlAdjustPrivilege(ULONG,BOOLEAN,BOOLEAN,PBOOLEAN);
NTSYSAPI NTSTATUS WINAPI RtlAllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,PSID *);
NTSYSAPI RTL_HANDLE * WINAPI RtlAllocateHandle(RTL_HANDLE_TABLE *,ULONG *);
NTSYSAPI PVOID WINAPI RtlAllocateHeap(HANDLE,ULONG,SIZE_T) __WINE_ALLOC_SIZE(3);
NTSYSAPI PVOID WINAPI RtlAllocateHeap(HANDLE,ULONG,SIZE_T) __WINE_ALLOC_SIZE(3) __WINE_MALLOC;
NTSYSAPI WCHAR WINAPI RtlAnsiCharToUnicodeChar(LPSTR *);
NTSYSAPI DWORD WINAPI RtlAnsiStringToUnicodeSize(const STRING *);
NTSYSAPI NTSTATUS WINAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING,PCANSI_STRING,BOOLEAN);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment