=?UTF-8?Q?Iv=C3=A1n=20Matellanes=20?=: msvcirt: Simplify some constructors and assignments.

Alexandre Julliard julliard at winehq.org
Wed Aug 10 11:05:57 CDT 2016


Module: wine
Branch: master
Commit: 4b11bd80835ad7ca289b80d97499fbcf672e5fc4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4b11bd80835ad7ca289b80d97499fbcf672e5fc4

Author: Iván Matellanes <matellanesivan at gmail.com>
Date:   Tue Aug  9 19:16:05 2016 +0100

msvcirt: Simplify some constructors and assignments.

Signed-off-by: Iván Matellanes <matellanesivan at gmail.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at 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 at PAVstreambuf@@@Z */
-/* ??0ostream@@QEAA at PEAVstreambuf@@@Z */
-DEFINE_THISCALL_WRAPPER(ostream_sb_ctor, 12)
-ostream* __thiscall ostream_sb_ctor(ostream *this, streambuf *sb, BOOL virt_init)
+/* ??0ostream@@IAE at XZ */
+/* ??0ostream@@IEAA at 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 at PAVstreambuf@@@Z */
+/* ??0ostream@@QEAA at 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 at ABV0@@Z */
 /* ??0ostream@@IEAA at 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 at XZ */
-/* ??0ostream@@IEAA at 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 at XZ */
 /* ??1ostream@@UEAA at XZ */
 /* ??1ostream_withassign@@UAE at 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 at PAVstreambuf@@@Z */
-/* ??0istream@@QEAA at PEAVstreambuf@@@Z */
-DEFINE_THISCALL_WRAPPER(istream_sb_ctor, 12)
-istream* __thiscall istream_sb_ctor(istream *this, streambuf *sb, BOOL virt_init)
+/* ??0istream@@IAE at XZ */
+/* ??0istream@@IEAA at 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 at PAVstreambuf@@@Z */
+/* ??0istream@@QEAA at 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 at ABV0@@Z */
 /* ??0istream@@IEAA at 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 at XZ */
-/* ??0istream@@IEAA at 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 at XZ */
 /* ??1istream@@UEAA at XZ */
 /* ??1istream_withassign@@UAE at XZ */




More information about the wine-cvs mailing list