Module: wine Branch: master Commit: 5f62da109e978e23be6c7ff0850dd64080ad26ae URL: http://source.winehq.org/git/wine.git/?a=commit;h=5f62da109e978e23be6c7ff085...
Author: Michael Stefaniuc mstefani@redhat.de Date: Wed Apr 25 00:57:55 2007 +0200
janitorial: Pass HEAP_ZERO_MEMORY as flag to HeapAlloc() instead of zeroing out the allocated memory in a later call.
---
dlls/dbghelp/module.c | 4 +--- dlls/gdi32/tests/font.c | 3 +-- dlls/imm32/imm.c | 3 +-- dlls/msvfw32/msvideo_main.c | 3 +-- dlls/ntdll/tests/port.c | 6 ++---- dlls/ole32/storage32.c | 5 +---- dlls/winex11.drv/xfont.c | 7 ++----- dlls/wininet/ftp.c | 3 +-- dlls/wininet/internet.c | 5 ++--- dlls/winspool.drv/info.c | 5 ++--- programs/oleview/tree.c | 3 +-- programs/oleview/typelib.c | 3 +-- 12 files changed, 16 insertions(+), 34 deletions(-)
diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index 21c8830..c2a3f04 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -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;
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index fefb448..bfe2a47 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -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); diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 0aa28f0..bc3f7a9 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -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; } diff --git a/dlls/msvfw32/msvideo_main.c b/dlls/msvfw32/msvideo_main.c index 7651687..1361d30 100644 --- a/dlls/msvfw32/msvideo_main.c +++ b/dlls/msvfw32/msvideo_main.c @@ -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; diff --git a/dlls/ntdll/tests/port.c b/dlls/ntdll/tests/port.c index c64067d..9715917 100644 --- a/dlls/ntdll/tests/port.c +++ b/dlls/ntdll/tests/port.c @@ -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) { diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 97f53df..5b4314f 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -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);
/* diff --git a/dlls/winex11.drv/xfont.c b/dlls/winex11.drv/xfont.c index 60bd70d..b53da7e 100644 --- a/dlls/winex11.drv/xfont.c +++ b/dlls/winex11.drv/xfont.c @@ -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); diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c index 40026fd..604f383 100644 --- a/dlls/wininet/ftp.c +++ b/dlls/wininet/ftp.c @@ -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); diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 6345a5b..3bfa62f 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -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; diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c index 8ecf795..a6d65ea 100644 --- a/dlls/winspool.drv/info.c +++ b/dlls/winspool.drv/info.c @@ -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)) { diff --git a/programs/oleview/tree.c b/programs/oleview/tree.c index d776740..348c4f2 100644 --- a/programs/oleview/tree.c +++ b/programs/oleview/tree.c @@ -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); diff --git a/programs/oleview/typelib.c b/programs/oleview/typelib.c index baba628..1acdd84 100644 --- a/programs/oleview/typelib.c +++ b/programs/oleview/typelib.c @@ -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';