[PATCH 3/5] user32/listbox: Shrink the item array with resize_storage

Gabriel Iv─âncescu gabrielopcode at gmail.com
Fri Feb 8 05:17:20 CST 2019


Signed-off-by: Gabriel Iv─âncescu <gabrielopcode at gmail.com>
---
 dlls/user32/listbox.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index 80ba38b..3bd1b58 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -1678,7 +1678,6 @@ static void LISTBOX_DeleteItem( LB_DESCR *descr, INT index )
 static LRESULT LISTBOX_RemoveItem( LB_DESCR *descr, INT index )
 {
     LB_ITEMDATA *item;
-    INT max_items;
 
     if ((index < 0) || (index >= descr->nb_items)) return LB_ERR;
 
@@ -1698,20 +1697,8 @@ static LRESULT LISTBOX_RemoveItem( LB_DESCR *descr, INT index )
                        (descr->nb_items - index) * sizeof(LB_ITEMDATA) );
     if (descr->anchor_item == descr->nb_items) descr->anchor_item--;
 
-    /* Shrink the item array if possible */
+    resize_storage(descr, descr->nb_items);
 
-    max_items = descr->items_size;
-    if (descr->nb_items < max_items - 2*LB_ARRAY_GRANULARITY)
-    {
-        max_items -= LB_ARRAY_GRANULARITY;
-        item = HeapReAlloc( GetProcessHeap(), 0, descr->items,
-                            max_items * sizeof(LB_ITEMDATA) );
-        if (item)
-        {
-            descr->items_size = max_items;
-            descr->items = item;
-        }
-    }
     /* Repaint the items */
 
     LISTBOX_UpdateScroll( descr );
-- 
2.19.1




More information about the wine-devel mailing list