summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/EncodingCXX.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-04-03 12:43:51 (GMT)
committerBrad King <brad.king@kitware.com>2014-04-03 12:43:51 (GMT)
commit23b4abb26082fbaec523ad48f4be54f55c11b58c (patch)
tree8f18daecdd3e7bdde88271fe56fbef48fa5b7693 /Source/kwsys/EncodingCXX.cxx
parent9f69a34f9990faefc28ac095fd874404cf07963b (diff)
parenteccc425af6ffeb52963cc2dd94a36a24c271108b (diff)
downloadCMake-23b4abb26082fbaec523ad48f4be54f55c11b58c.zip
CMake-23b4abb26082fbaec523ad48f4be54f55c11b58c.tar.gz
CMake-23b4abb26082fbaec523ad48f4be54f55c11b58c.tar.bz2
Merge branch 'upstream-kwsys' into update-kwsys
Diffstat (limited to 'Source/kwsys/EncodingCXX.cxx')
-rw-r--r--Source/kwsys/EncodingCXX.cxx19
1 files changed, 11 insertions, 8 deletions
diff --git a/Source/kwsys/EncodingCXX.cxx b/Source/kwsys/EncodingCXX.cxx
index f76deb5..251a56d 100644
--- a/Source/kwsys/EncodingCXX.cxx
+++ b/Source/kwsys/EncodingCXX.cxx
@@ -110,16 +110,19 @@ Encoding::CommandLineArguments::
Encoding::CommandLineArguments&
Encoding::CommandLineArguments::operator=(const CommandLineArguments& other)
{
- size_t i;
- for(i=0; i<this->argv_.size(); i++)
+ if(this != &other)
{
- free(this->argv_[i]);
- }
+ size_t i;
+ for(i=0; i<this->argv_.size(); i++)
+ {
+ free(this->argv_[i]);
+ }
- this->argv_.resize(other.argv_.size());
- for(i=0; i<this->argv_.size(); i++)
- {
- this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : 0;
+ this->argv_.resize(other.argv_.size());
+ for(i=0; i<this->argv_.size(); i++)
+ {
+ this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : 0;
+ }
}
return *this;