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
45dc6c0e
Commit
45dc6c0e
authored
Sep 13, 2011
by
Piotr Caban
Committed by
Alexandre Julliard
Sep 13, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Improve operator new implementation.
parent
4c13e84a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
9 deletions
+23
-9
heap.c
dlls/msvcrt/heap.c
+23
-9
No files found.
dlls/msvcrt/heap.c
View file @
45dc6c0e
...
...
@@ -39,7 +39,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
~(alignment - 1)) - offset))
typedef
void
(
CDECL
*
MSVCRT_new_handler_func
)(
MSVCRT_size_t
size
);
typedef
int
(
CDECL
*
MSVCRT_new_handler_func
)(
MSVCRT_size_t
size
);
static
MSVCRT_new_handler_func
MSVCRT_new_handler
;
static
int
MSVCRT_new_mode
;
...
...
@@ -54,14 +54,28 @@ static MSVCRT_size_t MSVCRT_sbh_threshold = 0;
*/
void
*
CDECL
MSVCRT_operator_new
(
MSVCRT_size_t
size
)
{
void
*
retval
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
TRACE
(
"(%ld) returning %p
\n
"
,
size
,
retval
);
if
(
retval
)
return
retval
;
LOCK_HEAP
;
if
(
MSVCRT_new_handler
)
(
*
MSVCRT_new_handler
)(
size
);
UNLOCK_HEAP
;
return
retval
;
void
*
retval
;
int
freed
;
do
{
retval
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
retval
)
{
TRACE
(
"(%ld) returning %p
\n
"
,
size
,
retval
);
return
retval
;
}
LOCK_HEAP
;
if
(
MSVCRT_new_handler
)
freed
=
(
*
MSVCRT_new_handler
)(
size
);
else
freed
=
0
;
UNLOCK_HEAP
;
}
while
(
freed
);
TRACE
(
"(%ld) out of memory
\n
"
,
size
);
return
NULL
;
}
...
...
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