[libvtemm] Fixed assignment operator and removed unused code.



commit 067de2274a4d58ccd28b7dbe4182c25400df1236
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Tue Aug 11 15:53:11 2009 +0200

    Fixed assignment operator and removed unused code.
    
    * src/libvtemm/g/charattributes.ccg: operator= now will always
    return *this - earlier if this and copied instance were different
    function returned garbage. Also removed code, which was commented
    for a long time.

 src/libvtemm/g/charattributes.ccg |   26 ++------------------------
 1 files changed, 2 insertions(+), 24 deletions(-)
---
diff --git a/src/libvtemm/g/charattributes.ccg b/src/libvtemm/g/charattributes.ccg
index 68503b2..c9ab541 100644
--- a/src/libvtemm/g/charattributes.ccg
+++ b/src/libvtemm/g/charattributes.ccg
@@ -37,15 +37,6 @@ CharAttributes::CharAttributes(const CharAttributes& src)
   }
   else
   {
-    /*
-    gobject_ = new VteCharAttributes;
-    gobject_->row = src.gobject_->row;
-    gobject_->column = src.gobject_->column;
-    gobject_->fore = src.gobject_->fore;
-    gobject_->back = src.gobject_->back;
-    gobject_->underline = src.gobject_->underline;
-    gobject_->strikethrough = src.gobject_->strikethrough;
-    */
     gobject_ = new VteCharAttributes(*(src.gobj()));
   }
 }
@@ -54,15 +45,6 @@ CharAttributes::CharAttributes(VteCharAttributes* castitem, bool take_copy)
 {
   if (take_copy)
   {
-    /*
-    gobject_ = new VteCharAttributes;
-    gobject_->row = castitem->row;
-    gobject_->column = castitem->column;
-    gobject_->fore = castitem->fore;
-    gobject_->back = castitem->back;
-    gobject_->underline = castitem->underline;
-    gobject_->strikethrough = castitem->strikethrough;
-    */
     gobject_ = new VteCharAttributes(*castitem);
   }
   else
@@ -82,19 +64,15 @@ CharAttributes::~CharAttributes()
 
 CharAttributes& CharAttributes::operator=(const CharAttributes& src)
 {
-  if (&src == this)
-  {
-    return *this;
-  }
-  else
+  if (&src != this)
   {
     if (gobject_)
     {
       delete gobject_;
-      gobject_ = 0;
     }
     gobject_ = new VteCharAttributes(*(src.gobj()));
   }
+  return *this;
 }
 
 } // namespace Vte



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]