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
1bb92df7
Commit
1bb92df7
authored
May 03, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
May 20, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Return an entry pointer when looking for a free list.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f00da96a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
heap.c
dlls/ntdll/heap.c
+13
-12
No files found.
dlls/ntdll/heap.c
View file @
1bb92df7
...
...
@@ -401,16 +401,19 @@ static void notify_free_all( SUBHEAP *subheap )
/* locate a free list entry of the appropriate size */
/* size is the size of the whole block including the arena header */
static
inline
unsigned
int
get_freelist_index
(
SIZE_T
size
)
static
inline
struct
entry
*
find_free_list
(
HEAP
*
heap
,
SIZE_T
size
,
BOOL
last
)
{
FREE_LIST_ENTRY
*
list
,
*
end
=
heap
->
freeList
+
ARRAY_SIZE
(
heap
->
freeList
);
unsigned
int
i
;
if
(
size
<=
HEAP_MAX_SMALL_FREE_LIST
)
return
(
size
-
HEAP_MIN_ARENA_SIZE
)
/
ALIGNMENT
;
for
(
i
=
HEAP_NB_SMALL_FREE_LISTS
;
i
<
HEAP_NB_FREE_LISTS
-
1
;
i
++
)
i
=
(
size
-
HEAP_MIN_ARENA_SIZE
)
/
ALIGNMENT
;
else
for
(
i
=
HEAP_NB_SMALL_FREE_LISTS
;
i
<
HEAP_NB_FREE_LISTS
-
1
;
i
++
)
if
(
size
<=
HEAP_freeListSizes
[
i
-
HEAP_NB_SMALL_FREE_LISTS
])
break
;
return
i
;
list
=
heap
->
freeList
+
i
;
if
(
last
&&
++
list
==
end
)
list
=
heap
->
freeList
;
return
&
list
->
arena
;
}
/* get the memory protection type to use for a given heap */
...
...
@@ -587,18 +590,16 @@ static HEAP *HEAP_GetPtr(
static
inline
void
HEAP_InsertFreeBlock
(
HEAP
*
heap
,
ARENA_FREE
*
pArena
,
BOOL
last
)
{
SIZE_T
block_size
=
(
pArena
->
size
&
ARENA_SIZE_MASK
)
+
sizeof
(
*
pArena
);
FREE_LIST_ENTRY
*
pEntry
=
heap
->
freeList
+
get_freelist_index
(
block_size
);
struct
entry
*
list
=
find_free_list
(
heap
,
block_size
,
last
);
if
(
last
)
{
/* insert at end of free list, i.e. before the next free list entry */
pEntry
++
;
if
(
pEntry
==
&
heap
->
freeList
[
HEAP_NB_FREE_LISTS
])
pEntry
=
heap
->
freeList
;
list_add_before
(
&
pEntry
->
arena
.
entry
,
&
pArena
->
entry
);
list_add_before
(
&
list
->
entry
,
&
pArena
->
entry
);
}
else
{
/* insert at head of free list */
list_add_after
(
&
pEntry
->
arena
.
entry
,
&
pArena
->
entry
);
list_add_after
(
&
list
->
entry
,
&
pArena
->
entry
);
}
}
...
...
@@ -1065,14 +1066,14 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
*/
static
ARENA_FREE
*
HEAP_FindFreeBlock
(
HEAP
*
heap
,
SIZE_T
data_size
,
SUBHEAP
**
ppSubHeap
)
{
struct
entry
*
entry
=
find_free_list
(
heap
,
data_size
+
sizeof
(
ARENA_INUSE
),
FALSE
);
SUBHEAP
*
subheap
;
struct
list
*
ptr
;
SIZE_T
total_size
;
FREE_LIST_ENTRY
*
pEntry
=
heap
->
freeList
+
get_freelist_index
(
data_size
+
sizeof
(
ARENA_INUSE
)
);
/* Find a suitable free list, and in it find a block large enough */
ptr
=
&
pEntry
->
arena
.
entry
;
ptr
=
&
entry
->
entry
;
while
((
ptr
=
list_next
(
&
heap
->
freeList
[
0
].
arena
.
entry
,
ptr
)))
{
ARENA_FREE
*
pArena
=
LIST_ENTRY
(
ptr
,
ARENA_FREE
,
entry
);
...
...
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