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
8c8e1638
Commit
8c8e1638
authored
May 04, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
May 23, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Introduce new helper to update block type.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
parent
2db2c94d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
heap.c
dlls/ntdll/heap.c
+9
-3
No files found.
dlls/ntdll/heap.c
View file @
8c8e1638
...
...
@@ -231,6 +231,12 @@ static inline UINT block_get_type( const struct block *block )
return
block
->
magic
;
}
static
inline
void
block_set_type
(
struct
block
*
block
,
UINT
type
)
{
if
(
type
>>
24
)
block
->
unused_bytes
=
type
>>
24
;
block
->
magic
=
type
;
}
static
inline
UINT
block_get_overhead
(
const
struct
block
*
block
)
{
if
(
block_get_flags
(
block
)
&
ARENA_FLAG_FREE
)
return
sizeof
(
struct
entry
);
...
...
@@ -685,7 +691,7 @@ static void create_free_block( SUBHEAP *subheap, struct block *block, SIZE_T blo
BOOL
last
;
mark_block_uninitialized
(
block
,
sizeof
(
*
entry
)
);
entry
->
magic
=
ARENA_FREE_MAGIC
;
block_set_type
(
block
,
ARENA_FREE_MAGIC
)
;
/* If debugging, erase the freed block content */
...
...
@@ -737,7 +743,7 @@ static void HEAP_MakeInUseBlockFree( SUBHEAP *subheap, ARENA_INUSE *pArena )
ARENA_INUSE
*
prev
=
heap
->
pending_free
[
heap
->
pending_pos
];
heap
->
pending_free
[
heap
->
pending_pos
]
=
pArena
;
heap
->
pending_pos
=
(
heap
->
pending_pos
+
1
)
%
MAX_FREE_PENDING
;
pArena
->
magic
=
ARENA_PENDING_MAGIC
;
block_set_type
(
pArena
,
ARENA_PENDING_MAGIC
)
;
mark_block_free
(
pArena
+
1
,
pArena
->
size
&
ARENA_SIZE_MASK
,
heap
->
flags
);
if
(
!
prev
)
return
;
pArena
=
prev
;
...
...
@@ -1536,7 +1542,7 @@ static NTSTATUS heap_allocate( HEAP *heap, ULONG flags, SIZE_T size, void **ret
/* in-use arena is smaller than free arena,
* so we have to add the difference to the size */
block
->
size
=
(
block
->
size
&
~
ARENA_FLAG_FREE
)
+
sizeof
(
struct
entry
)
-
sizeof
(
*
block
);
block
->
magic
=
ARENA_INUSE_MAGIC
;
block
_set_type
(
block
,
ARENA_INUSE_MAGIC
)
;
/* Shrink the block */
...
...
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