Commit 5f62da10 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

janitorial: Pass HEAP_ZERO_MEMORY as flag to HeapAlloc() instead of zeroing out…

janitorial: Pass HEAP_ZERO_MEMORY as flag to HeapAlloc() instead of zeroing out the allocated memory in a later call.
parent b7b379b0
......@@ -129,11 +129,9 @@ struct module* module_new(struct process* pcs, const WCHAR* name,
struct module* module;
assert(type == DMT_ELF || type == DMT_PE);
if (!(module = HeapAlloc(GetProcessHeap(), 0, sizeof(*module))))
if (!(module = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*module))))
return NULL;
memset(module, 0, sizeof(*module));
module->next = pcs->lmodules;
pcs->lmodules = module;
......
......@@ -482,8 +482,7 @@ static void test_text_extents(void)
}
len = lstrlenW(wt);
extents = HeapAlloc(GetProcessHeap(), 0, len * sizeof extents[0]);
memset(extents, 0, len * sizeof extents[0]);
extents = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof extents[0]);
extents[0] = 1; /* So that the increasing sequence test will fail
if the extents array is untouched. */
GetTextExtentExPointW(hdc, wt, len, 32767, &fit1, extents, &sz1);
......
......@@ -313,8 +313,7 @@ HIMC WINAPI ImmCreateContext(void)
{
InputContextData *new_context;
new_context = HeapAlloc(GetProcessHeap(),0,sizeof(InputContextData));
ZeroMemory(new_context,sizeof(InputContextData));
new_context = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(InputContextData));
return (HIMC)new_context;
}
......
......@@ -1294,10 +1294,9 @@ HANDLE VFWAPI ICImageDecompress(
cbHdr = ICDecompressGetFormatSize(hic,lpbiIn);
if ( cbHdr < sizeof(BITMAPINFOHEADER) )
goto err;
pHdr = HeapAlloc(GetProcessHeap(),0,cbHdr+sizeof(RGBQUAD)*256);
pHdr = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,cbHdr+sizeof(RGBQUAD)*256);
if ( pHdr == NULL )
goto err;
ZeroMemory( pHdr, cbHdr+sizeof(RGBQUAD)*256 );
if ( ICDecompressGetFormat( hic, lpbiIn, (BITMAPINFO*)pHdr ) != ICERR_OK )
goto err;
lpbiOut = (BITMAPINFO*)pHdr;
......
......@@ -199,10 +199,9 @@ static DWORD WINAPI test_ports_client(LPVOID arg)
ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %d\n", status);
size = FIELD_OFFSET(LPC_MESSAGE, Data) + MAX_MESSAGE_LEN;
LpcMessage = HeapAlloc(GetProcessHeap(), 0, size);
LpcMessage = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
out = HeapAlloc(GetProcessHeap(), 0, size);
memset(LpcMessage, 0, size);
LpcMessage->DataSize = lstrlen(REQUEST1) + 1;
LpcMessage->MessageSize = FIELD_OFFSET(LPC_MESSAGE, Data) + LpcMessage->DataSize;
lstrcpy((LPSTR)LpcMessage->Data, REQUEST1);
......@@ -252,8 +251,7 @@ static void test_ports_server(void)
if (status != STATUS_SUCCESS) return;
size = FIELD_OFFSET(LPC_MESSAGE, Data) + MAX_MESSAGE_LEN;
LpcMessage = HeapAlloc(GetProcessHeap(), 0, size);
memset(LpcMessage, 0, size);
LpcMessage = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
while (TRUE)
{
......
......@@ -4223,16 +4223,13 @@ static StorageInternalImpl* StorageInternalImpl_Construct(
/*
* Allocate space for the new storage object
*/
newStorage = HeapAlloc(GetProcessHeap(), 0, sizeof(StorageInternalImpl));
newStorage = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(StorageInternalImpl));
if (newStorage!=0)
{
memset(newStorage, 0, sizeof(StorageInternalImpl));
/*
* Initialize the stream list
*/
list_init(&newStorage->base.strmHead);
/*
......
......@@ -2035,13 +2035,10 @@ static int XFONT_BuildMetrics(char** x_pattern, int res, unsigned x_checksum, in
if( !fr ) /* add new family */
{
n_ff++;
fr = HeapAlloc(GetProcessHeap(), 0, sizeof(fontResource));
fr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(fontResource));
if (fr)
{
memset(fr, 0, sizeof(fontResource));
fr->resource = HeapAlloc(GetProcessHeap(), 0, sizeof(LFD));
memset(fr->resource, 0, sizeof(LFD));
fr->resource = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LFD));
TRACE("family: -%s-%s-\n", lfd.foundry, lfd.family );
fr->resource->foundry = HeapAlloc(GetProcessHeap(), 0, strlen(lfd.foundry)+1);
......
......@@ -2673,8 +2673,7 @@ static BOOL FTP_SendData(LPWININETFTPSESSIONW lpwfs, INT nDataSocket, HANDLE hFi
CHAR *lpszBuffer;
TRACE("\n");
lpszBuffer = HeapAlloc(GetProcessHeap(), 0, sizeof(CHAR)*DATA_PACKET_SIZE);
memset(lpszBuffer, 0, sizeof(CHAR)*DATA_PACKET_SIZE);
lpszBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CHAR)*DATA_PACKET_SIZE);
/* Get the size of the file. */
GetFileInformationByHandle(hFile, &fi);
......
......@@ -467,14 +467,13 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType,
/* Clear any error information */
INTERNET_SetLastError(0);
lpwai = HeapAlloc(GetProcessHeap(), 0, sizeof(WININETAPPINFOW));
lpwai = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WININETAPPINFOW));
if (NULL == lpwai)
{
INTERNET_SetLastError(ERROR_OUTOFMEMORY);
goto lend;
}
memset(lpwai, 0, sizeof(WININETAPPINFOW));
lpwai->hdr.htype = WH_HINIT;
lpwai->hdr.dwFlags = dwFlags;
lpwai->hdr.dwRefCount = 1;
......
......@@ -2876,10 +2876,9 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter)
}
if(pi->pDevMode)
dmW = pi->pDevMode;
else
else
{
dmW = HeapAlloc(GetProcessHeap(), 0, size);
ZeroMemory(dmW,size);
dmW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
dmW->dmSize = size;
if (0>DocumentPropertiesW(0,0,pi->pPrinterName,dmW,NULL,DM_OUT_BUFFER))
{
......
......@@ -41,8 +41,7 @@ static LPARAM CreateITEM_INFO(INT flag, const WCHAR *info, const WCHAR *clsid, c
{
ITEM_INFO *reg;
reg = HeapAlloc(GetProcessHeap(), 0, sizeof(ITEM_INFO));
memset(reg, 0, sizeof(ITEM_INFO));
reg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ITEM_INFO));
reg->cFlag = flag;
lstrcpyW(reg->info, info);
......
......@@ -258,9 +258,8 @@ static TYPELIB_DATA *InitializeTLData(void)
{
TYPELIB_DATA *pTLData;
pTLData = HeapAlloc(GetProcessHeap(), 0, sizeof(TYPELIB_DATA));
pTLData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TYPELIB_DATA));
memset(pTLData, 0, sizeof(TYPELIB_DATA));
pTLData->idl = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR));
pTLData->idl[0] = '\0';
......
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