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)
}
/*********************************************************************
* _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.@)
*/
void* CDECL DECLSPEC_HOTPATCH MSVCRT_operator_new(MSVCRT_size_t size)
{
void *retval;
int freed;
MSVCRT_new_handler_func handler;
do
{
......@@ -142,13 +152,7 @@ void* CDECL DECLSPEC_HOTPATCH MSVCRT_operator_new(MSVCRT_size_t size)
TRACE("(%ld) returning %p\n", size, retval);
return retval;
}
handler = MSVCRT_new_handler;
if(handler)
freed = (*handler)(size);
else
freed = 0;
} while(freed);
} while(_callnewh(size));
TRACE("(%ld) out of memory\n", size);
#if _MSVCR_VER >= 80
......@@ -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.@)
*/
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