kernel32: Remove superfluous heap reallocation calls in FormatMessageA/W.

The buffer in question is temporary and will be freed on function 
return, so resizing and leaving the enlarged space unused is pointless.
This commit is contained in:
Andrew Nguyen 2010-04-18 09:08:42 -05:00 committed by Alexandre Julliard
parent f35ca2a77c
commit c0e7931954
1 changed files with 0 additions and 5 deletions

View File

@ -565,9 +565,6 @@ DWORD WINAPI FormatMessageA(
*t='\0';
}
talloced = strlen(target)+1;
if (nSize && talloced<nSize) {
target = HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,target,nSize);
}
TRACE("-- %s\n",debugstr_a(target));
if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) {
*((LPVOID*)lpBuffer) = LocalAlloc(LMEM_ZEROINIT,max(nSize, talloced));
@ -744,8 +741,6 @@ DWORD WINAPI FormatMessageW(
*t='\0';
}
talloced = strlenW(target)+1;
if (nSize && talloced<nSize)
target = HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,target,nSize*sizeof(WCHAR));
if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) {
/* nSize is the MINIMUM size */
DWORD len = strlenW(target) + 1;