msvcrt: Use _callnewh in operator new implementation.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
70ac780e6e
commit
7e9cba139d
|
@ -125,14 +125,24 @@ static MSVCRT_size_t msvcrt_heap_size(void *ptr)
|
|||
return HeapSize(heap, 0, 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
|
||||
|
@ -230,18 +234,6 @@ int CDECL MSVCRT__set_new_mode(int mode)
|
|||
return old_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.@)
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue