Commit 5e3f959a authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Simplify throw_exception helper.

parent 1c9a30f2
...@@ -616,15 +616,11 @@ void msvcrt_init_exception(void *base) ...@@ -616,15 +616,11 @@ void msvcrt_init_exception(void *base)
} }
#if _MSVCR_VER >= 80 #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; bad_alloc e;
__exception_ctor(&e, str, &bad_alloc_vtable); __exception_ctor(&e, "bad allocation", &bad_alloc_vtable);
_CxxThrowException(&e, &bad_alloc_exception_type); _CxxThrowException(&e, &bad_alloc_exception_type);
}
}
} }
#endif #endif
......
...@@ -156,7 +156,7 @@ void* CDECL DECLSPEC_HOTPATCH operator_new(size_t size) ...@@ -156,7 +156,7 @@ void* CDECL DECLSPEC_HOTPATCH operator_new(size_t size)
TRACE("(%Iu) out of memory\n", size); TRACE("(%Iu) out of memory\n", size);
#if _MSVCR_VER >= 80 #if _MSVCR_VER >= 80
throw_exception(EXCEPTION_BAD_ALLOC, 0, "bad allocation"); throw_bad_alloc();
#endif #endif
return NULL; return NULL;
} }
......
...@@ -187,10 +187,7 @@ extern WORD *MSVCRT__pwctype; ...@@ -187,10 +187,7 @@ extern WORD *MSVCRT__pwctype;
void msvcrt_set_errno(int) DECLSPEC_HIDDEN; void msvcrt_set_errno(int) DECLSPEC_HIDDEN;
#if _MSVCR_VER >= 80 #if _MSVCR_VER >= 80
typedef enum { void throw_bad_alloc(void) DECLSPEC_HIDDEN;
EXCEPTION_BAD_ALLOC,
} exception_type;
void throw_exception(exception_type, HRESULT, const char*) DECLSPEC_HIDDEN;
#endif #endif
void __cdecl _purecall(void); void __cdecl _purecall(void);
......
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