Nikolay Sivov : comctl32/button: Use the global memory allocation helpers.

Alexandre Julliard julliard at winehq.org
Tue Feb 13 13:57:56 CST 2018


Module: wine
Branch: master
Commit: 9d897b73a877e5eaae26df87930c951ff8273c14
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9d897b73a877e5eaae26df87930c951ff8273c14

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Feb 13 16:19:58 2018 +0300

comctl32/button: Use the global memory allocation helpers.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/button.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c
index dccddf9..7184d19 100644
--- a/dlls/comctl32/button.c
+++ b/dlls/comctl32/button.c
@@ -67,6 +67,7 @@
 #include "uxtheme.h"
 #include "vssym32.h"
 #include "wine/debug.h"
+#include "wine/heap.h"
 
 #include "comctl32.h"
 
@@ -224,7 +225,7 @@ static inline void paint_button( HWND hwnd, LONG style, UINT action )
 static inline WCHAR *get_button_text( HWND hwnd )
 {
     INT len = GetWindowTextLengthW( hwnd );
-    WCHAR *buffer = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) );
+    WCHAR *buffer = heap_alloc( (len + 1) * sizeof(WCHAR) );
     if (buffer)
         GetWindowTextW( hwnd, buffer, len + 1 );
     return buffer;
@@ -732,14 +733,14 @@ static UINT BUTTON_CalcLabelRect(HWND hwnd, HDC hdc, RECT *rc)
           if (!(text = get_button_text( hwnd ))) goto empty_rect;
           if (!text[0])
           {
-              HeapFree( GetProcessHeap(), 0, text );
+              heap_free( text );
               goto empty_rect;
           }
 
           if ((hFont = get_button_font( hwnd ))) hPrevFont = SelectObject( hdc, hFont );
           DrawTextW(hdc, text, -1, &r, dtStyle | DT_CALCRECT);
           if (hPrevFont) SelectObject( hdc, hPrevFont );
-          HeapFree( GetProcessHeap(), 0, text );
+          heap_free( text );
           break;
       }
 
@@ -873,7 +874,7 @@ static void BUTTON_DrawLabel(HWND hwnd, HDC hdc, UINT dtFlags, const RECT *rc)
 
    DrawStateW(hdc, hbr, lpOutputProc, lp, wp, rc->left, rc->top,
               rc->right - rc->left, rc->bottom - rc->top, flags);
-   HeapFree( GetProcessHeap(), 0, text );
+   heap_free( text );
 }
 
 /**********************************************************************
@@ -1278,7 +1279,7 @@ static void PB_ThemedPaint(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawSta
     if (text)
     {
         DrawThemeText(theme, hDC, BP_PUSHBUTTON, state, text, lstrlenW(text), dtFlags, 0, &textRect);
-        HeapFree(GetProcessHeap(), 0, text);
+        heap_free(text);
     }
 
     if (focused)
@@ -1378,7 +1379,7 @@ static void CB_ThemedPaint(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawSta
             DrawFocusRect( hDC, &focusRect );
         }
 
-        HeapFree(GetProcessHeap(), 0, text);
+        heap_free(text);
     }
 
     if (created_font) DeleteObject(font);
@@ -1438,7 +1439,7 @@ static void GB_ThemedPaint(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawSta
     {
         InflateRect(&textRect, -2, 0);
         DrawThemeText(theme, hDC, BP_GROUPBOX, state, text, lstrlenW(text), 0, 0, &textRect);
-        HeapFree(GetProcessHeap(), 0, text);
+        heap_free(text);
     }
 
     if (created_font) DeleteObject(font);




More information about the wine-cvs mailing list