=?UTF-8?Q?Gabriel=20Iv=C4=83ncescu=20?=: comctl32/listbox: Shrink the item array with resize_storage.
Alexandre Julliard
julliard at winehq.org
Thu Feb 7 16:20:56 CST 2019
Module: wine
Branch: master
Commit: ff873840485861b31d2923d4988826de295072da
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ff873840485861b31d2923d4988826de295072da
Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date: Thu Feb 7 15:12:22 2019 +0200
comctl32/listbox: Shrink the item array with resize_storage.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/comctl32/listbox.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c
index ec10189..4289aaa 100644
--- a/dlls/comctl32/listbox.c
+++ b/dlls/comctl32/listbox.c
@@ -1669,7 +1669,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;
@@ -1689,20 +1688,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 );
More information about the wine-cvs
mailing list