Changed more malloc to HeapAlloc calls

Michael Stefaniuc mstefani at redhat.com
Thu Oct 30 06:32:04 CDT 2008


Hello Pete,

James Hawkins wrote:
> On Wed, Oct 29, 2008 at 8:02 PM, Pete Myers
> <peterdanielmyers at googlemail.com> wrote:
>> It does match the style of the way that HeapAlloc is used elsewhere in the
>> file, though not malloc admittedly.  I wasn't sure which convention had
>> precedent.
>>
> 
> Please bottom-post when replying to a post on the wine lists.  There
> is one test function that uses a space after opening parentheses, but
> it's the exception, not the rule.
> 
>> I'm afraid that I don't understand how my changelog doesn't match the
>> patch.  I'm new here, can you help me out?  There's obviously something I'm
>> missing!
>>
> 
> You had several 'changelog' entries in the email, but the last one was
> 
> Changelog:
> * malloc calls in dlls/kernel32/process.c have been change to HeapAlloc
> 
> which does not match the patch.
In addition to what James said please split the patch up; one patch per 
module. A dll or program is a "module".

Also while you are at it please remove the superfluous casts in the 
lines you are changing. HeapAlloc (malloc too) returns a void pointer 
which doesn't needs to be casted to an other pointer type. E.g.
--- a/dlls/iphlpapi/tests/iphlpapi.c
+++ b/dlls/iphlpapi/tests/iphlpapi.c
@@ -225,7 +225,7 @@ static void testGetIpAddrTable(void)
       "GetIpAddrTable(NULL, &dwSize, FALSE) returned %d, expected 
ERROR_INSUFFICIENT_BUFFER\n",
       apiReturn);
      if (apiReturn == ERROR_INSUFFICIENT_BUFFER) {
-      PMIB_IPADDRTABLE buf = (PMIB_IPADDRTABLE)malloc(dwSize);
+      PMIB_IPADDRTABLE buf = (PMIB_IPADDRTABLE)HeapAlloc( 
GetProcessHeap(), 0, dwSize);

        apiReturn = gGetIpAddrTable(buf, &dwSize, FALSE);
        ok(apiReturn == NO_ERROR,

should really be just:
        PMIB_IPADDRTABLE buf = HeapAlloc(GetProcessHeap(), 0, dwSize);

thanks
bye
	michael




More information about the wine-devel mailing list