Rémi Bernon : ntdll: Merge common resize case in heap_realloc.

Alexandre Julliard julliard at winehq.org
Tue May 31 15:57:59 CDT 2022


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Mon May 30 22:26:48 2022 +0200

ntdll: Merge common resize case in heap_realloc.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>

---

 dlls/ntdll/heap.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index 4050c00c265..0102ba3ea42 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -1609,8 +1609,6 @@ static NTSTATUS heap_reallocate( HEAP *heap, ULONG flags, void *ptr, SIZE_T size
             list_remove( &entry->entry );
             old_block_size += block_get_size( next );
             if (!subheap_commit( subheap, block, block_size )) return STATUS_NO_MEMORY;
-            valgrind_notify_resize( block + 1, old_size, size );
-            shrink_used_block( subheap, block, block_get_flags( block ), old_block_size, block_size, size );
         }
         else
         {
@@ -1624,13 +1622,9 @@ static NTSTATUS heap_reallocate( HEAP *heap, ULONG flags, void *ptr, SIZE_T size
             return STATUS_SUCCESS;
         }
     }
-    else
-    {
-        valgrind_notify_resize( block + 1, old_size, size );
-        shrink_used_block( subheap, block, block_get_flags( block ), old_block_size, block_size, size );
-    }
 
-    /* Clear the extra bytes if needed */
+    valgrind_notify_resize( block + 1, old_size, size );
+    shrink_used_block( subheap, block, block_get_flags( block ), old_block_size, block_size, size );
 
     if (size <= old_size) mark_block_tail( (char *)(block + 1) + size, block->unused_bytes, flags );
     else initialize_block( (char *)(block + 1) + old_size, size - old_size, block->unused_bytes, flags );




More information about the wine-cvs mailing list