Commit 7e9cba13 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Use _callnewh in operator new implementation.

parent 70ac780e
...@@ -126,13 +126,23 @@ static MSVCRT_size_t msvcrt_heap_size(void *ptr) ...@@ -126,13 +126,23 @@ static MSVCRT_size_t msvcrt_heap_size(void *ptr)
} }
/********************************************************************* /*********************************************************************
* _callnewh (MSVCRT.@)
*/
int CDECL _callnewh(MSVCRT_size_t size)
{
int ret = 0;
MSVCRT_new_handler_func handler = MSVCRT_new_handler;
if(handler)
ret = (*handler)(size) ? 1 : 0;
return ret;
}
/*********************************************************************
* ??2@YAPAXI@Z (MSVCRT.@) * ??2@YAPAXI@Z (MSVCRT.@)
*/ */
void* CDECL DECLSPEC_HOTPATCH MSVCRT_operator_new(MSVCRT_size_t size) void* CDECL DECLSPEC_HOTPATCH MSVCRT_operator_new(MSVCRT_size_t size)
{ {
void *retval; void *retval;
int freed;
MSVCRT_new_handler_func handler;
do do
{ {
...@@ -142,13 +152,7 @@ void* CDECL DECLSPEC_HOTPATCH MSVCRT_operator_new(MSVCRT_size_t size) ...@@ -142,13 +152,7 @@ void* CDECL DECLSPEC_HOTPATCH MSVCRT_operator_new(MSVCRT_size_t size)
TRACE("(%ld) returning %p\n", size, retval); TRACE("(%ld) returning %p\n", size, retval);
return retval; return retval;
} }
} while(_callnewh(size));
handler = MSVCRT_new_handler;
if(handler)
freed = (*handler)(size);
else
freed = 0;
} while(freed);
TRACE("(%ld) out of memory\n", size); TRACE("(%ld) out of memory\n", size);
#if _MSVCR_VER >= 80 #if _MSVCR_VER >= 80
...@@ -231,18 +235,6 @@ int CDECL MSVCRT__set_new_mode(int mode) ...@@ -231,18 +235,6 @@ int CDECL MSVCRT__set_new_mode(int mode)
} }
/********************************************************************* /*********************************************************************
* _callnewh (MSVCRT.@)
*/
int CDECL _callnewh(MSVCRT_size_t size)
{
int ret = 0;
MSVCRT_new_handler_func handler = MSVCRT_new_handler;
if(handler)
ret = (*handler)(size) ? 1 : 0;
return ret;
}
/*********************************************************************
* _expand (MSVCRT.@) * _expand (MSVCRT.@)
*/ */
void* CDECL _expand(void* mem, MSVCRT_size_t size) void* CDECL _expand(void* mem, MSVCRT_size_t size)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment