msvcrt: Simplify throw_exception helper.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1c9a30f217
commit
5e3f959aed
|
@ -616,15 +616,11 @@ void msvcrt_init_exception(void *base)
|
|||
}
|
||||
|
||||
#if _MSVCR_VER >= 80
|
||||
void throw_exception(exception_type et, HRESULT hr, const char *str)
|
||||
void throw_bad_alloc(void)
|
||||
{
|
||||
switch(et) {
|
||||
case EXCEPTION_BAD_ALLOC: {
|
||||
bad_alloc e;
|
||||
__exception_ctor(&e, str, &bad_alloc_vtable);
|
||||
_CxxThrowException(&e, &bad_alloc_exception_type);
|
||||
}
|
||||
}
|
||||
bad_alloc e;
|
||||
__exception_ctor(&e, "bad allocation", &bad_alloc_vtable);
|
||||
_CxxThrowException(&e, &bad_alloc_exception_type);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ void* CDECL DECLSPEC_HOTPATCH operator_new(size_t size)
|
|||
|
||||
TRACE("(%Iu) out of memory\n", size);
|
||||
#if _MSVCR_VER >= 80
|
||||
throw_exception(EXCEPTION_BAD_ALLOC, 0, "bad allocation");
|
||||
throw_bad_alloc();
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -187,10 +187,7 @@ extern WORD *MSVCRT__pwctype;
|
|||
|
||||
void msvcrt_set_errno(int) DECLSPEC_HIDDEN;
|
||||
#if _MSVCR_VER >= 80
|
||||
typedef enum {
|
||||
EXCEPTION_BAD_ALLOC,
|
||||
} exception_type;
|
||||
void throw_exception(exception_type, HRESULT, const char*) DECLSPEC_HIDDEN;
|
||||
void throw_bad_alloc(void) DECLSPEC_HIDDEN;
|
||||
#endif
|
||||
|
||||
void __cdecl _purecall(void);
|
||||
|
|
Loading…
Reference in New Issue