Module: wine Branch: master Commit: c0e7931954de1d363267ef58ecb23fd87585f005 URL: http://source.winehq.org/git/wine.git/?a=commit;h=c0e7931954de1d363267ef58ec...
Author: Andrew Nguyen anguyen@codeweavers.com Date: Sun Apr 18 09:08:42 2010 -0500
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.
---
dlls/kernel32/format_msg.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/dlls/kernel32/format_msg.c b/dlls/kernel32/format_msg.c index c312acd..f579d21 100644 --- a/dlls/kernel32/format_msg.c +++ b/dlls/kernel32/format_msg.c @@ -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;