Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
a3acd635
Commit
a3acd635
authored
May 03, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
May 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Rename local variables in heap_reallocate.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9325bfad
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
28 deletions
+24
-28
heap.c
dlls/ntdll/heap.c
+24
-28
No files found.
dlls/ntdll/heap.c
View file @
a3acd635
...
...
@@ -1646,17 +1646,16 @@ BOOLEAN WINAPI DECLSPEC_HOTPATCH RtlFreeHeap( HANDLE heap, ULONG flags, void *pt
static
NTSTATUS
heap_reallocate
(
HEAP
*
heap
,
ULONG
flags
,
void
*
ptr
,
SIZE_T
size
,
void
**
ret
)
{
struct
block
*
next
;
ARENA_INUSE
*
pArena
;
SIZE_T
old_data_size
,
old_size
,
data_size
;
struct
block
*
next
,
*
block
;
SUBHEAP
*
subheap
;
SIZE_T
oldBlockSize
,
oldActualSize
,
rounded_size
;
NTSTATUS
status
;
rounded
_size
=
ROUND_SIZE
(
size
)
+
HEAP_TAIL_EXTRA_SIZE
(
flags
);
if
(
rounded
_size
<
size
)
return
STATUS_NO_MEMORY
;
/* overflow */
if
(
rounded_size
<
HEAP_MIN_DATA_SIZE
)
rounded
_size
=
HEAP_MIN_DATA_SIZE
;
data
_size
=
ROUND_SIZE
(
size
)
+
HEAP_TAIL_EXTRA_SIZE
(
flags
);
if
(
data
_size
<
size
)
return
STATUS_NO_MEMORY
;
/* overflow */
if
(
data_size
<
HEAP_MIN_DATA_SIZE
)
data
_size
=
HEAP_MIN_DATA_SIZE
;
if
(
!
(
pArena
=
unsafe_block_from_ptr
(
heap
,
ptr
,
&
subheap
)))
return
STATUS_INVALID_PARAMETER
;
if
(
!
(
block
=
unsafe_block_from_ptr
(
heap
,
ptr
,
&
subheap
)))
return
STATUS_INVALID_PARAMETER
;
if
(
!
subheap
)
{
if
(
!
(
*
ret
=
realloc_large_block
(
heap
,
flags
,
ptr
,
size
)))
return
STATUS_NO_MEMORY
;
...
...
@@ -1665,49 +1664,46 @@ static NTSTATUS heap_reallocate( HEAP *heap, ULONG flags, void *ptr, SIZE_T size
/* Check if we need to grow the block */
old
BlockSize
=
(
pArena
->
size
&
ARENA_SIZE_MASK
);
old
ActualSize
=
(
pArena
->
size
&
ARENA_SIZE_MASK
)
-
pArena
->
unused_bytes
;
if
(
rounded_size
>
oldBlockS
ize
)
old
_data_size
=
(
block
->
size
&
ARENA_SIZE_MASK
);
old
_size
=
(
block
->
size
&
ARENA_SIZE_MASK
)
-
block
->
unused_bytes
;
if
(
data_size
>
old_data_s
ize
)
{
if
((
next
=
next_block
(
subheap
,
pArena
))
&&
(
block_get_flags
(
next
)
&
ARENA_FLAG_FREE
)
&&
rounded_size
<
HEAP_MIN_LARGE_BLOCK_SIZE
&&
rounded_size
<=
oldBlockS
ize
+
block_get_size
(
next
))
if
((
next
=
next_block
(
subheap
,
block
))
&&
(
block_get_flags
(
next
)
&
ARENA_FLAG_FREE
)
&&
data_size
<
HEAP_MIN_LARGE_BLOCK_SIZE
&&
data_size
<=
old_data_s
ize
+
block_get_size
(
next
))
{
/* The next block is free and large enough */
struct
entry
*
entry
=
(
struct
entry
*
)
next
;
list_remove
(
&
entry
->
entry
);
pArena
->
size
+=
block_get_size
(
next
);
if
(
!
HEAP_Commit
(
subheap
,
pArena
,
rounded
_size
))
return
STATUS_NO_MEMORY
;
notify_realloc
(
pArena
+
1
,
oldActualS
ize
,
size
);
shrink_used_block
(
subheap
,
pArena
,
rounded
_size
,
size
);
block
->
size
+=
block_get_size
(
next
);
if
(
!
HEAP_Commit
(
subheap
,
block
,
data
_size
))
return
STATUS_NO_MEMORY
;
notify_realloc
(
block
+
1
,
old_s
ize
,
size
);
shrink_used_block
(
subheap
,
block
,
data
_size
,
size
);
}
else
{
if
(
flags
&
HEAP_REALLOC_IN_PLACE_ONLY
)
return
STATUS_NO_MEMORY
;
if
((
status
=
heap_allocate
(
heap
,
flags
&
~
HEAP_ZERO_MEMORY
,
size
,
ret
)))
return
status
;
memcpy
(
*
ret
,
pArena
+
1
,
oldActualS
ize
);
if
(
flags
&
HEAP_ZERO_MEMORY
)
memset
(
(
char
*
)
*
ret
+
old
ActualSize
,
0
,
size
-
oldActualS
ize
);
notify_free
(
p
Arena
+
1
);
HEAP_MakeInUseBlockFree
(
subheap
,
pArena
);
memcpy
(
*
ret
,
block
+
1
,
old_s
ize
);
if
(
flags
&
HEAP_ZERO_MEMORY
)
memset
(
(
char
*
)
*
ret
+
old
_size
,
0
,
size
-
old_s
ize
);
notify_free
(
p
tr
);
HEAP_MakeInUseBlockFree
(
subheap
,
block
);
return
STATUS_SUCCESS
;
}
}
else
{
notify_realloc
(
pArena
+
1
,
oldActualS
ize
,
size
);
shrink_used_block
(
subheap
,
pArena
,
rounded
_size
,
size
);
notify_realloc
(
block
+
1
,
old_s
ize
,
size
);
shrink_used_block
(
subheap
,
block
,
data
_size
,
size
);
}
/* Clear the extra bytes if needed */
if
(
size
>
oldActualSize
)
initialize_block
(
(
char
*
)(
pArena
+
1
)
+
oldActualSize
,
size
-
oldActualSize
,
pArena
->
unused_bytes
,
flags
);
else
mark_block_tail
(
(
char
*
)(
pArena
+
1
)
+
size
,
pArena
->
unused_bytes
,
flags
);
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
);
/* Return the new arena */
*
ret
=
pArena
+
1
;
*
ret
=
block
+
1
;
return
STATUS_SUCCESS
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment