Hello,
may I ask why you are replacing the simple malloc/free calls by the more complicated HeapAlloc API? This just makes the source longer and less readable. There is no point in avoiding C library usage in Winefile. It is just a unix application using Wine libraries - not a Wine system library.
Regards,
Martin
On 24.07.2007 07:06:08 Alexandre Julliard wrote:
Module: wine Branch: master Commit: 11bb71d3d6a34d301291b2d15c849a1381bd7789 URL: http://source.winehq.org/git/wine.git/?a=commit;h=11bb71d3d6a34d301291b2d15c... 49a1381bd7789
Author: Michael Stefaniuc mstefani@redhat.de Date: Mon Jul 23 22:25:20 2007 +0200
winefile: Replace malloc with HeapAlloc.
- Entry* entry = (Entry*) malloc(sizeof(Entry));
- Entry* entry = HeapAlloc(GetProcessHeap(), 0, sizeof(Entry));
- free(entry);
- HeapFree(GetProcessHeap(), 0, entry);
}
Hello Martin,
Martin Fuchs wrote:
may I ask why you are replacing the simple malloc/free calls by the more complicated HeapAlloc API? This just makes the source longer and less readable. There is no point in avoiding C library usage in Winefile. It is just a unix application using Wine libraries - not a Wine system library.
It's not a Wine system library, true. But it is definitely not a unix application; it's a Windows application that knows about the underlying unix system if it is compiled for Wine. To keep it consistent with the rest of the wine code it makes sense to move it to the HeapFree/HeapAlloc functions.
For somebody used to Windows/Wine code it isn't less readable. And for the length of the code: Half of the lines with the calls do not exceed 80 chars and the other half that exceeds that is still shorter then the surrounding code. I pondered writing some macros around HeapFree/HeapAlloc but dropped the idea due to that and because there aren't that many calls to those functions.
bye michael
On 24.07.2007 07:06:08 Alexandre Julliard wrote:
Module: wine Branch: master Commit: 11bb71d3d6a34d301291b2d15c849a1381bd7789 URL: http://source.winehq.org/git/wine.git/?a=commit;h=11bb71d3d6a34d301291b2d15c...
49a1381bd7789
Author: Michael Stefaniuc mstefani@redhat.de Date: Mon Jul 23 22:25:20 2007 +0200
winefile: Replace malloc with HeapAlloc.
- Entry* entry = (Entry*) malloc(sizeof(Entry));
- Entry* entry = HeapAlloc(GetProcessHeap(), 0, sizeof(Entry));
- free(entry);
- HeapFree(GetProcessHeap(), 0, entry);
}