[PATCH 1/3] msvcp90: Add macro that define type_info vtable.
Arkadiusz Hiler
ahiler at codeweavers.com
Tue Apr 6 09:05:09 CDT 2021
From: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Arkadiusz Hiler <ahiler at codeweavers.com>
---
dlls/msvcp90/cxx.h | 32 ++++++++++++++++++++++++++++++++
dlls/msvcp90/exception.c | 32 ++------------------------------
2 files changed, 34 insertions(+), 30 deletions(-)
diff --git a/dlls/msvcp90/cxx.h b/dlls/msvcp90/cxx.h
index 02735a3c168..5052f433875 100644
--- a/dlls/msvcp90/cxx.h
+++ b/dlls/msvcp90/cxx.h
@@ -449,3 +449,35 @@ typedef struct
} cxx_exception_type;
#endif
+
+#define CREATE_TYPE_INFO_VTABLE\
+ static void MSVCP_type_info_dtor(type_info * _this) \
+{ \
+ free(_this->name); \
+} \
+\
+DEFINE_THISCALL_WRAPPER(MSVCP_type_info_vector_dtor,8) \
+void * __thiscall MSVCP_type_info_vector_dtor(type_info * _this, unsigned int flags) \
+{ \
+ if (flags & 2) \
+ { \
+ /* we have an array, with the number of elements stored before the first object */ \
+ INT_PTR i, *ptr = (INT_PTR *)_this - 1; \
+\
+ for (i = *ptr - 1; i >= 0; i--) MSVCP_type_info_dtor(_this + i); \
+ free(ptr); \
+ } \
+ else \
+ { \
+ MSVCP_type_info_dtor(_this); \
+ if (flags & 1) free(_this); \
+ } \
+ return _this; \
+} \
+\
+DEFINE_RTTI_DATA0( type_info, 0, ".?AVtype_info@@" ) \
+\
+__ASM_BLOCK_BEGIN(type_info_vtables) \
+ __ASM_VTABLE(type_info, \
+ VTABLE_ADD_FUNC(MSVCP_type_info_vector_dtor)); \
+__ASM_BLOCK_END
diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c
index 8ea4e132a0f..496dd915608 100644
--- a/dlls/msvcp90/exception.c
+++ b/dlls/msvcp90/exception.c
@@ -26,6 +26,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
+CREATE_TYPE_INFO_VTABLE
+
#define CLASS_IS_SIMPLE_TYPE 1
#define CLASS_HAS_VIRTUAL_BASE_CLASS 4
@@ -65,34 +67,6 @@ extern const vtable_ptr MSVCP_bad_cast_vtable;
/* ??_7range_error at std@@6B@ */
extern const vtable_ptr MSVCP_range_error_vtable;
-static void MSVCP_type_info_dtor(type_info * _this)
-{
- free(_this->name);
-}
-
-/* Unexported */
-DEFINE_THISCALL_WRAPPER(MSVCP_type_info_vector_dtor,8)
-void * __thiscall MSVCP_type_info_vector_dtor(type_info * _this, unsigned int flags)
-{
- TRACE("(%p %x)\n", _this, flags);
- if (flags & 2)
- {
- /* we have an array, with the number of elements stored before the first object */
- INT_PTR i, *ptr = (INT_PTR *)_this - 1;
-
- for (i = *ptr - 1; i >= 0; i--) MSVCP_type_info_dtor(_this + i);
- MSVCRT_operator_delete(ptr);
- }
- else
- {
- MSVCP_type_info_dtor(_this);
- if (flags & 1) MSVCRT_operator_delete(_this);
- }
- return _this;
-}
-
-DEFINE_RTTI_DATA0( type_info, 0, ".?AVtype_info@@" )
-
/* ??0exception@@QAE at ABQBD@Z */
/* ??0exception@@QEAA at AEBQEBD@Z */
DEFINE_THISCALL_WRAPPER(MSVCP_exception_ctor,8)
@@ -1022,8 +996,6 @@ void __cdecl __ExceptionPtrDestroy(exception_ptr *ep)
#endif
__ASM_BLOCK_BEGIN(exception_vtables)
- __ASM_VTABLE(type_info,
- VTABLE_ADD_FUNC(MSVCP_type_info_vector_dtor));
EXCEPTION_VTABLE(exception,
VTABLE_ADD_FUNC(MSVCP_exception_vector_dtor)
VTABLE_ADD_FUNC(MSVCP_exception_what));
--
2.31.1
More information about the wine-devel
mailing list