From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/listbox.c | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-)
diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c index 6724dee1487..d29cfc3968a 100644 --- a/dlls/comctl32/listbox.c +++ b/dlls/comctl32/listbox.c @@ -33,7 +33,6 @@ #include "vssym32.h" #include "wine/exception.h" #include "wine/debug.h" -#include "wine/heap.h"
#include "comctl32.h"
@@ -153,7 +152,7 @@ static BOOL resize_storage(LB_DESCR *descr, UINT items_size) items_size = (items_size + LB_ARRAY_GRANULARITY - 1) & ~(LB_ARRAY_GRANULARITY - 1); if ((descr->style & (LBS_NODATA | LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != LBS_NODATA) { - items = heap_realloc(descr->u.items, items_size * get_sizeof_item(descr)); + items = realloc(descr->u.items, items_size * get_sizeof_item(descr)); if (!items) { SEND_NOTIFICATION(descr, LBN_ERRSPACE); @@ -819,16 +818,15 @@ static BOOL LISTBOX_SetTabStops( LB_DESCR *descr, INT count, LPINT tabs ) return FALSE; }
- HeapFree( GetProcessHeap(), 0, descr->tabs ); + free( descr->tabs ); if (!(descr->nb_tabs = count)) { descr->tabs = NULL; return TRUE; } - if (!(descr->tabs = HeapAlloc( GetProcessHeap(), 0, - descr->nb_tabs * sizeof(INT) ))) + if (!(descr->tabs = malloc( descr->nb_tabs * sizeof(*descr->tabs) ))) return FALSE; - memcpy( descr->tabs, tabs, descr->nb_tabs * sizeof(INT) ); + memcpy( descr->tabs, tabs, descr->nb_tabs * sizeof(*descr->tabs) );
/* convert into "dialog units"*/ for (i = 0; i < descr->nb_tabs; i++) @@ -1695,7 +1693,7 @@ static LRESULT LISTBOX_InsertString( LB_DESCR *descr, INT index, LPCWSTR str ) if (HAS_STRINGS(descr)) { if (!str) str = L""; - if (!(new_str = HeapAlloc( GetProcessHeap(), 0, (lstrlenW(str) + 1) * sizeof(WCHAR) ))) + if (!(new_str = malloc( (lstrlenW(str) + 1) * sizeof(WCHAR) ))) { SEND_NOTIFICATION( descr, LBN_ERRSPACE ); return LB_ERRSPACE; @@ -1706,7 +1704,7 @@ static LRESULT LISTBOX_InsertString( LB_DESCR *descr, INT index, LPCWSTR str ) if (index == -1) index = descr->nb_items; if ((ret = LISTBOX_InsertItem( descr, index, new_str, (ULONG_PTR)str )) != 0) { - HeapFree( GetProcessHeap(), 0, new_str ); + free( new_str ); return ret; }
@@ -1740,7 +1738,7 @@ static void LISTBOX_DeleteItem( LB_DESCR *descr, INT index ) dis.itemData = get_item_data(descr, index); SendMessageW( descr->owner, WM_DELETEITEM, id, (LPARAM)&dis ); } - HeapFree( GetProcessHeap(), 0, get_item_string(descr, index) ); + free( get_item_string(descr, index) ); }
@@ -1807,7 +1805,7 @@ static void LISTBOX_ResetContent( LB_DESCR *descr )
if (!(descr->style & LBS_NODATA)) for (i = descr->nb_items - 1; i >= 0; i--) LISTBOX_DeleteItem(descr, i); - HeapFree( GetProcessHeap(), 0, descr->u.items ); + free( descr->u.items ); descr->nb_items = 0; descr->top_item = 0; descr->selected_item = -1; @@ -2563,7 +2561,7 @@ static BOOL LISTBOX_Create( HWND hwnd, LPHEADCOMBO lphc ) MEASUREITEMSTRUCT mis; RECT rect;
- if (!(descr = HeapAlloc( GetProcessHeap(), 0, sizeof(*descr) ))) + if (!(descr = calloc( 1, sizeof(*descr) ))) return FALSE;
GetClientRect( hwnd, &rect ); @@ -2572,26 +2570,13 @@ static BOOL LISTBOX_Create( HWND hwnd, LPHEADCOMBO lphc ) descr->style = GetWindowLongW( descr->self, GWL_STYLE ); descr->width = rect.right - rect.left; descr->height = rect.bottom - rect.top; - descr->u.items = NULL; - descr->items_size = 0; - descr->nb_items = 0; - descr->top_item = 0; descr->selected_item = -1; - descr->focus_item = 0; descr->anchor_item = -1; descr->item_height = 1; descr->page_size = 1; descr->column_width = 150; - descr->horz_extent = 0; - descr->horz_pos = 0; - descr->nb_tabs = 0; - descr->tabs = NULL; - descr->wheel_remain = 0; descr->caret_on = !lphc; if (descr->style & LBS_NOSEL) descr->caret_on = FALSE; - descr->in_focus = FALSE; - descr->captured = FALSE; - descr->font = 0; descr->locale = GetUserDefaultLCID(); descr->lphc = lphc;
@@ -2651,7 +2636,7 @@ static BOOL LISTBOX_Destroy( LB_DESCR *descr ) CloseThemeData( theme ); LISTBOX_ResetContent( descr ); SetWindowLongPtrW( descr->self, 0, 0 ); - HeapFree( GetProcessHeap(), 0, descr ); + free( descr ); return TRUE; }