[PATCH v4 06/11] comctl32/listbox: Use InitStorage to allocate in InsertItem

Gabriel Ivăncescu gabrielopcode at gmail.com
Wed Nov 21 13:15:09 CST 2018


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/comctl32/listbox.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c
index 0638cdb..e05ab6f 100644
--- a/dlls/comctl32/listbox.c
+++ b/dlls/comctl32/listbox.c
@@ -1526,19 +1526,8 @@ static LRESULT LISTBOX_InsertItem( LB_DESCR *descr, INT index,
     if (descr->nb_items == max_items)
     {
         /* We need to grow the array */
-        max_items += LB_ARRAY_GRANULARITY;
-	if (descr->items)
-	    item = HeapReAlloc( GetProcessHeap(), 0, descr->items,
-                                  max_items * sizeof(LB_ITEMDATA) );
-	else
-	    item = HeapAlloc( GetProcessHeap(), 0,
-                                  max_items * sizeof(LB_ITEMDATA) );
-        if (!item)
-        {
-            SEND_NOTIFICATION( descr, LBN_ERRSPACE );
+        if (LISTBOX_InitStorage(descr, 1) == LB_ERRSPACE)
             return LB_ERRSPACE;
-        }
-        descr->items = item;
     }
 
     /* Insert the item structure */
-- 
2.19.1




More information about the wine-devel mailing list