summaryrefslogtreecommitdiffstats
path: root/Source/cmCommandArgumentParserHelper.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-06-13 14:11:44 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-06-13 14:11:44 (GMT)
commit043ddabc91c78b59b5e8d4e276cc527a1ddc39d7 (patch)
treeb8bb4e60fe5c4b0ab61e5a9ce5a3520b7bd71b7e /Source/cmCommandArgumentParserHelper.cxx
parent733c1c193be4c0d1bcdb28387b597542d92cbd42 (diff)
downloadCMake-043ddabc91c78b59b5e8d4e276cc527a1ddc39d7.zip
CMake-043ddabc91c78b59b5e8d4e276cc527a1ddc39d7.tar.gz
CMake-043ddabc91c78b59b5e8d4e276cc527a1ddc39d7.tar.bz2
ENH: More optimization
Diffstat (limited to 'Source/cmCommandArgumentParserHelper.cxx')
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx23
1 files changed, 8 insertions, 15 deletions
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 18f6fe5..b2a31c8 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -157,27 +157,20 @@ void cmCommandArgumentParserHelper::Print(const char* place, const char* str)
}
}
-char* cmCommandArgumentParserHelper::CombineUnions(const char* in1, const char* in2)
+char* cmCommandArgumentParserHelper::CombineUnions(char* in1, char* in2)
{
- int len = 1;
- if ( in1 )
+ if ( !in1 )
{
- len += strlen(in1);
+ return in2;
}
- if ( in2 )
+ else if ( !in2 )
{
- len += strlen(in2);
+ return in1;
}
+ int len = strlen(in1) + strlen(in2) + 1;
char* out = new char [ len ];
- out[0] = 0;
- if ( in1 )
- {
- strcat(out, in1);
- }
- if ( in2 )
- {
- strcat(out, in2);
- }
+ strcpy(out, in1);
+ strcat(out, in2);
return *(m_Variables.insert(out).first);
}