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

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

parent fd1b9afc
......@@ -1656,15 +1656,15 @@ 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) __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 ExFreePool(PVOID);
PVOID WINAPI ExAllocatePool(POOL_TYPE,SIZE_T) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(ExFreePool) __WINE_MALLOC;
PVOID WINAPI ExAllocatePoolWithQuota(POOL_TYPE,SIZE_T) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(ExFreePool) __WINE_MALLOC;
void WINAPI ExFreePoolWithTag(PVOID,ULONG);
PVOID WINAPI ExAllocatePoolWithTag(POOL_TYPE,SIZE_T,ULONG) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(ExFreePoolWithTag) __WINE_MALLOC;
PVOID WINAPI ExAllocatePoolWithQuotaTag(POOL_TYPE,SIZE_T,ULONG) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(ExFreePoolWithTag) __WINE_MALLOC;
void WINAPI ExDeleteNPagedLookasideList(PNPAGED_LOOKASIDE_LIST);
void WINAPI ExDeletePagedLookasideList(PPAGED_LOOKASIDE_LIST);
NTSTATUS WINAPI ExDeleteResourceLite(ERESOURCE*);
void WINAPI ExFreePool(PVOID);
void WINAPI ExFreePoolWithTag(PVOID,ULONG);
ULONG WINAPI ExGetExclusiveWaiterCount(ERESOURCE*);
ULONG WINAPI ExGetSharedWaiterCount(ERESOURCE*);
void WINAPI ExInitializeNPagedLookasideList(PNPAGED_LOOKASIDE_LIST,PALLOCATE_FUNCTION,PFREE_FUNCTION,ULONG,SIZE_T,ULONG,USHORT);
......@@ -1792,11 +1792,11 @@ NTSTATUS WINAPI KeWaitForMultipleObjects(ULONG,void*[],WAIT_TYPE,KWAIT_REASON,K
NTSTATUS WINAPI KeWaitForSingleObject(void*,KWAIT_REASON,KPROCESSOR_MODE,BOOLEAN,LARGE_INTEGER*);
PVOID WINAPI MmAllocateContiguousMemory(SIZE_T,PHYSICAL_ADDRESS) __WINE_ALLOC_SIZE(1) __WINE_MALLOC;
PVOID WINAPI MmAllocateNonCachedMemory(SIZE_T) __WINE_ALLOC_SIZE(1) __WINE_MALLOC;
void WINAPI MmFreeNonCachedMemory(PVOID,SIZE_T);
PVOID WINAPI MmAllocateNonCachedMemory(SIZE_T) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(MmFreeNonCachedMemory) __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*);
void WINAPI MmFreeNonCachedMemory(PVOID,SIZE_T);
void * WINAPI MmGetSystemRoutineAddress(UNICODE_STRING*);
PVOID WINAPI MmMapLockedPagesSpecifyCache(PMDLX,KPROCESSOR_MODE,MEMORY_CACHING_TYPE,PVOID,ULONG,MM_PAGE_PRIORITY);
MM_SYSTEMSIZE WINAPI MmQuerySystemSize(void);
......
......@@ -317,9 +317,9 @@ 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) __WINE_MALLOC;
void WINAPI CoTaskMemFree(LPVOID ptr);
LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, SIZE_T size) __WINE_ALLOC_SIZE(2);
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(CoTaskMemFree) __WINE_MALLOC;
LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, SIZE_T size) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(CoTaskMemFree);
HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy);
HRESULT WINAPI CoRevokeMallocSpy(void);
......
......@@ -38,10 +38,10 @@ DEFINE_OLEGUID(IID_StdOle, 0x00020430,0,0);
ULONG WINAPI OaBuildVersion(void);
/* BSTR functions */
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);
BSTR WINAPI SysAllocString(const OLECHAR*) __WINE_DEALLOC(SysFreeString) __WINE_MALLOC;
BSTR WINAPI SysAllocStringByteLen(LPCSTR,UINT) __WINE_DEALLOC(SysFreeString) __WINE_MALLOC;
BSTR WINAPI SysAllocStringLen(const OLECHAR*,UINT) __WINE_DEALLOC(SysFreeString) __WINE_MALLOC;
INT WINAPI SysReAllocString(LPBSTR,const OLECHAR*);
int WINAPI SysReAllocStringLen(BSTR*,const OLECHAR*,UINT);
UINT WINAPI SysStringByteLen(BSTR);
......
......@@ -667,10 +667,10 @@ RPCRTAPI RPC_STATUS RPC_ENTRY
NdrMapCommAndFaultStatus( PMIDL_STUB_MESSAGE pStubMsg, ULONG *pCommStatus,
ULONG *pFaultStatus, RPC_STATUS Status_ );
RPCRTAPI void* RPC_ENTRY
NdrOleAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1) __WINE_MALLOC;
RPCRTAPI void RPC_ENTRY
NdrOleFree( void* NodeToFree );
RPCRTAPI void* RPC_ENTRY
NdrOleAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(NdrOleFree) __WINE_MALLOC;
RPCRTAPI void RPC_ENTRY
NdrClientInitialize( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE pStubMsg,
......@@ -728,14 +728,14 @@ RPCRTAPI void RPC_ENTRY
NdrRpcSsDisableAllocate( PMIDL_STUB_MESSAGE pMessage );
RPCRTAPI void RPC_ENTRY
NdrRpcSmSetClientToOsf( PMIDL_STUB_MESSAGE pMessage );
RPCRTAPI void * RPC_ENTRY
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) __WINE_MALLOC;
NdrRpcSmClientAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(NdrRpcSmClientFree) __WINE_MALLOC;
RPCRTAPI void RPC_ENTRY
NdrRpcSsDefaultFree( void *NodeToFree );
RPCRTAPI void * RPC_ENTRY
NdrRpcSsDefaultAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(NdrRpcSsDefaultFree) __WINE_MALLOC;
RPCRTAPI RPC_STATUS RPC_ENTRY
NdrGetUserMarshalInfo( ULONG *pFlags, ULONG InformationLevel, NDR_USER_MARSHAL_INFO *pMarshalInfo );
......
......@@ -2350,7 +2350,8 @@ 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) __WINE_MALLOC;
WINBASEAPI HGLOBAL WINAPI GlobalFree(HGLOBAL);
WINBASEAPI HGLOBAL WINAPI GlobalAlloc(UINT,SIZE_T) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(GlobalFree) __WINE_MALLOC;
WINBASEAPI SIZE_T WINAPI GlobalCompact(DWORD);
WINBASEAPI ATOM WINAPI GlobalDeleteAtom(ATOM);
WINBASEAPI ATOM WINAPI GlobalFindAtomA(LPCSTR);
......@@ -2358,7 +2359,6 @@ WINBASEAPI ATOM WINAPI GlobalFindAtomW(LPCWSTR);
#define GlobalFindAtom WINELIB_NAME_AW(GlobalFindAtom)
WINBASEAPI VOID WINAPI GlobalFix(HGLOBAL);
WINBASEAPI UINT WINAPI GlobalFlags(HGLOBAL);
WINBASEAPI HGLOBAL WINAPI GlobalFree(HGLOBAL);
WINBASEAPI UINT WINAPI GlobalGetAtomNameA(ATOM,LPSTR,INT);
WINBASEAPI UINT WINAPI GlobalGetAtomNameW(ATOM,LPWSTR,INT);
#define GlobalGetAtomName WINELIB_NAME_AW(GlobalGetAtomName)
......@@ -2366,20 +2366,20 @@ WINBASEAPI HGLOBAL WINAPI GlobalHandle(LPCVOID);
WINBASEAPI LPVOID WINAPI GlobalLock(HGLOBAL);
WINBASEAPI VOID WINAPI GlobalMemoryStatus(LPMEMORYSTATUS);
WINBASEAPI BOOL WINAPI GlobalMemoryStatusEx(LPMEMORYSTATUSEX);
WINBASEAPI HGLOBAL WINAPI GlobalReAlloc(HGLOBAL,SIZE_T,UINT) __WINE_ALLOC_SIZE(2);
WINBASEAPI HGLOBAL WINAPI GlobalReAlloc(HGLOBAL,SIZE_T,UINT) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(GlobalFree);
WINBASEAPI SIZE_T WINAPI GlobalSize(HGLOBAL);
WINBASEAPI VOID WINAPI GlobalUnfix(HGLOBAL);
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) __WINE_MALLOC;
WINBASEAPI BOOL WINAPI HeapFree(HANDLE,DWORD,LPVOID);
WINBASEAPI LPVOID WINAPI HeapAlloc(HANDLE,DWORD,SIZE_T) __WINE_ALLOC_SIZE(3) __WINE_DEALLOC(HeapFree,3) __WINE_MALLOC;
WINBASEAPI SIZE_T WINAPI HeapCompact(HANDLE,DWORD);
WINBASEAPI HANDLE WINAPI HeapCreate(DWORD,SIZE_T,SIZE_T);
WINBASEAPI BOOL WINAPI HeapDestroy(HANDLE);
WINBASEAPI BOOL WINAPI HeapFree(HANDLE,DWORD,LPVOID);
WINBASEAPI BOOL WINAPI HeapLock(HANDLE);
WINBASEAPI LPVOID WINAPI HeapReAlloc(HANDLE,DWORD,LPVOID,SIZE_T) __WINE_ALLOC_SIZE(4);
WINBASEAPI LPVOID WINAPI HeapReAlloc(HANDLE,DWORD,LPVOID,SIZE_T) __WINE_ALLOC_SIZE(4) __WINE_DEALLOC(HeapFree);
WINBASEAPI BOOL WINAPI HeapQueryInformation(HANDLE,HEAP_INFORMATION_CLASS,PVOID,SIZE_T,PSIZE_T);
WINBASEAPI BOOL WINAPI HeapSetInformation(HANDLE,HEAP_INFORMATION_CLASS,PVOID,SIZE_T);
WINBASEAPI SIZE_T WINAPI HeapSize(HANDLE,DWORD,LPCVOID);
......@@ -2440,13 +2440,13 @@ 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) __WINE_MALLOC;
WINBASEAPI HLOCAL WINAPI LocalFree(HLOCAL);
WINBASEAPI HLOCAL WINAPI LocalAlloc(UINT,SIZE_T) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(LocalFree) __WINE_MALLOC;
WINBASEAPI SIZE_T WINAPI LocalCompact(UINT);
WINBASEAPI UINT WINAPI LocalFlags(HLOCAL);
WINBASEAPI HLOCAL WINAPI LocalFree(HLOCAL);
WINBASEAPI HLOCAL WINAPI LocalHandle(LPCVOID);
WINBASEAPI LPVOID WINAPI LocalLock(HLOCAL);
WINBASEAPI HLOCAL WINAPI LocalReAlloc(HLOCAL,SIZE_T,UINT) __WINE_ALLOC_SIZE(2);
WINBASEAPI HLOCAL WINAPI LocalReAlloc(HLOCAL,SIZE_T,UINT) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(LocalFree);
WINBASEAPI SIZE_T WINAPI LocalShrink(HGLOBAL,UINT);
WINBASEAPI SIZE_T WINAPI LocalSize(HLOCAL);
WINBASEAPI BOOL WINAPI LocalUnlock(HLOCAL);
......
......@@ -4043,9 +4043,9 @@ 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) __WINE_MALLOC;
LPVOID WINAPI CryptMemRealloc(LPVOID pv, ULONG cbSize) __WINE_ALLOC_SIZE(2);
VOID WINAPI CryptMemFree(LPVOID pv);
LPVOID WINAPI CryptMemAlloc(ULONG cbSize) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(CryptMemFree) __WINE_MALLOC;
LPVOID WINAPI CryptMemRealloc(LPVOID pv, ULONG cbSize) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(CryptMemFree);
BOOL WINAPI CryptBinaryToStringA(const BYTE *pbBinary,
DWORD cbBinary, DWORD dwFlags, LPSTR pszString, DWORD *pcchString);
......
......@@ -204,6 +204,12 @@ extern "C" {
#define __WINE_ALLOC_SIZE(...)
#endif
#if defined(__GNUC__) && (__GNUC__ > 10)
#define __WINE_DEALLOC(...) __attribute__((malloc (__VA_ARGS__)))
#else
#define __WINE_DEALLOC(...)
#endif
#if defined(__GNUC__) && (__GNUC__ > 2)
#define __WINE_MALLOC __attribute__((malloc))
#else
......
......@@ -4200,7 +4200,8 @@ 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) __WINE_MALLOC;
NTSYSAPI BOOLEAN WINAPI RtlFreeHeap(HANDLE,ULONG,PVOID);
NTSYSAPI PVOID WINAPI RtlAllocateHeap(HANDLE,ULONG,SIZE_T) __WINE_ALLOC_SIZE(3) __WINE_DEALLOC(RtlFreeHeap,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