Module: wine Branch: master Commit: 4b11bd80835ad7ca289b80d97499fbcf672e5fc4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=4b11bd80835ad7ca289b80d974...
Author: Iván Matellanes matellanesivan@gmail.com Date: Tue Aug 9 19:16:05 2016 +0100
msvcirt: Simplify some constructors and assignments.
Signed-off-by: Iván Matellanes matellanesivan@gmail.com Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/msvcirt/msvcirt.c | 102 ++++++++++++++++++------------------------------- 1 file changed, 37 insertions(+), 65 deletions(-)
diff --git a/dlls/msvcirt/msvcirt.c b/dlls/msvcirt/msvcirt.c index 6533af0..fd721b5 100644 --- a/dlls/msvcirt/msvcirt.c +++ b/dlls/msvcirt/msvcirt.c @@ -2296,28 +2296,37 @@ static inline ostream* ios_to_ostream(const ios *base) return (ostream*)((char*)base - ostream_vbtable[1]); }
-/* ??0ostream@@QAE@PAVstreambuf@@@Z */ -/* ??0ostream@@QEAA@PEAVstreambuf@@@Z */ -DEFINE_THISCALL_WRAPPER(ostream_sb_ctor, 12) -ostream* __thiscall ostream_sb_ctor(ostream *this, streambuf *sb, BOOL virt_init) +/* ??0ostream@@IAE@XZ */ +/* ??0ostream@@IEAA@XZ */ +DEFINE_THISCALL_WRAPPER(ostream_ctor, 8) +ostream* __thiscall ostream_ctor(ostream *this, BOOL virt_init) { ios *base;
- TRACE("(%p %p %d)\n", this, sb, virt_init); + TRACE("(%p %d)\n", this, virt_init);
if (virt_init) { this->vbtable = ostream_vbtable; base = ostream_get_ios(this); - ios_sb_ctor(base, sb); - } else { + ios_ctor(base); + } else base = ostream_get_ios(this); - ios_init(base, sb); - } base->vtable = &MSVCP_ostream_vtable; this->unknown = 0; return this; }
+/* ??0ostream@@QAE@PAVstreambuf@@@Z */ +/* ??0ostream@@QEAA@PEAVstreambuf@@@Z */ +DEFINE_THISCALL_WRAPPER(ostream_sb_ctor, 12) +ostream* __thiscall ostream_sb_ctor(ostream *this, streambuf *sb, BOOL virt_init) +{ + TRACE("(%p %p %d)\n", this, sb, virt_init); + ostream_ctor(this, virt_init); + ios_init(ostream_get_ios(this), sb); + return this; +} + /* ??0ostream@@IAE@ABV0@@Z */ /* ??0ostream@@IEAA@AEBV0@@Z */ DEFINE_THISCALL_WRAPPER(ostream_copy_ctor, 12) @@ -2326,26 +2335,6 @@ ostream* __thiscall ostream_copy_ctor(ostream *this, const ostream *copy, BOOL v return ostream_sb_ctor(this, ostream_get_ios(copy)->sb, virt_init); }
-/* ??0ostream@@IAE@XZ */ -/* ??0ostream@@IEAA@XZ */ -DEFINE_THISCALL_WRAPPER(ostream_ctor, 8) -ostream* __thiscall ostream_ctor(ostream *this, BOOL virt_init) -{ - ios *base; - - TRACE("(%p %d)\n", this, virt_init); - - if (virt_init) { - this->vbtable = ostream_vbtable; - base = ostream_get_ios(this); - ios_ctor(base); - } else - base = ostream_get_ios(this); - base->vtable = &MSVCP_ostream_vtable; - this->unknown = 0; - return this; -} - /* ??1ostream@@UAE@XZ */ /* ??1ostream@@UEAA@XZ */ /* ??1ostream_withassign@@UAE@XZ */ @@ -2389,11 +2378,7 @@ ostream* __thiscall ostream_assign_sb(ostream *this, streambuf *sb) DEFINE_THISCALL_WRAPPER(ostream_assign, 8) ostream* __thiscall ostream_assign(ostream *this, const ostream *rhs) { - ios *base_rhs = ostream_get_ios(rhs); - - TRACE("(%p %p)\n", this, rhs); - - return ostream_assign_sb(this, base_rhs->sb); + return ostream_assign_sb(this, ostream_get_ios(rhs)->sb); }
/* ??_Dostream@@QAEXXZ */ @@ -2956,23 +2941,21 @@ static inline istream* ios_to_istream(const ios *base) return (istream*)((char*)base - istream_vbtable[1]); }
-/* ??0istream@@QAE@PAVstreambuf@@@Z */ -/* ??0istream@@QEAA@PEAVstreambuf@@@Z */ -DEFINE_THISCALL_WRAPPER(istream_sb_ctor, 12) -istream* __thiscall istream_sb_ctor(istream *this, streambuf *sb, BOOL virt_init) +/* ??0istream@@IAE@XZ */ +/* ??0istream@@IEAA@XZ */ +DEFINE_THISCALL_WRAPPER(istream_ctor, 8) +istream* __thiscall istream_ctor(istream *this, BOOL virt_init) { ios *base;
- TRACE("(%p %p %d)\n", this, sb, virt_init); + TRACE("(%p %d)\n", this, virt_init);
if (virt_init) { this->vbtable = istream_vbtable; base = istream_get_ios(this); - ios_sb_ctor(base, sb); - } else { + ios_ctor(base); + } else base = istream_get_ios(this); - ios_init(base, sb); - } base->vtable = &MSVCP_istream_vtable; base->flags |= FLAGS_skipws; this->extract_delim = 0; @@ -2980,6 +2963,17 @@ istream* __thiscall istream_sb_ctor(istream *this, streambuf *sb, BOOL virt_init return this; }
+/* ??0istream@@QAE@PAVstreambuf@@@Z */ +/* ??0istream@@QEAA@PEAVstreambuf@@@Z */ +DEFINE_THISCALL_WRAPPER(istream_sb_ctor, 12) +istream* __thiscall istream_sb_ctor(istream *this, streambuf *sb, BOOL virt_init) +{ + TRACE("(%p %p %d)\n", this, sb, virt_init); + istream_ctor(this, virt_init); + ios_init(istream_get_ios(this), sb); + return this; +} + /* ??0istream@@IAE@ABV0@@Z */ /* ??0istream@@IEAA@AEBV0@@Z */ DEFINE_THISCALL_WRAPPER(istream_copy_ctor, 12) @@ -2988,28 +2982,6 @@ istream* __thiscall istream_copy_ctor(istream *this, const istream *copy, BOOL v return istream_sb_ctor(this, istream_get_ios(copy)->sb, virt_init); }
-/* ??0istream@@IAE@XZ */ -/* ??0istream@@IEAA@XZ */ -DEFINE_THISCALL_WRAPPER(istream_ctor, 8) -istream* __thiscall istream_ctor(istream *this, BOOL virt_init) -{ - ios *base; - - TRACE("(%p %d)\n", this, virt_init); - - if (virt_init) { - this->vbtable = istream_vbtable; - base = istream_get_ios(this); - ios_ctor(base); - } else - base = istream_get_ios(this); - base->vtable = &MSVCP_istream_vtable; - base->flags |= FLAGS_skipws; - this->extract_delim = 0; - this->count = 0; - return this; -} - /* ??1istream@@UAE@XZ */ /* ??1istream@@UEAA@XZ */ /* ??1istream_withassign@@UAE@XZ */