Hello,
there is a lot (my attached smatch script found 234 occurences) of code like if (this) HeapFree(GetProcessHeap(), 0, this); HeapFree(GetProcessHeap(), 0, that);
which is redundant because after Win2000 (if i can trust the comment in RtlFreeHeap) freeing a NULL pointer isn't an error. I've checked it Win2000 and can confirm that. I've also checked Win95 and Win98 and both don't crash when HeapFree'ing a NULL but they return an error and SetLastError to 212 "ERROR_LOCKED". In the above code the return code of HeapFree isn't checked so this wouldn't matter if somebody would run the Wine code on that Win versions. So i propose to shorten that code to HeapFree(GetProcessHeap(), 0, this); HeapFree(GetProcessHeap(), 0, that); I've done this already for the wininet dll (see patch to wine-patches) and if it gets accepted i'll take care of the rest. Advantages: - less (redundant) code - more pleasant to the eye - for the wininet.dll it saves 1.1kB (FC2, gcc-3.3.3-7) in the generated code (ok, the wininet.dll.so is 1.6 MB but still)
Disadvantages: - if the pointer is NULL it takes longer for that code path. But i don't think it matters cause this happens mostly only on the (unlikely) error path.
bye michael