summaryrefslogtreecommitdiffstats
path: root/Source/cmDependsC.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2005-07-22 19:32:00 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2005-07-22 19:32:00 (GMT)
commitdc43a3d2657ae30c52ea7e0e6a6419c54119a00b (patch)
tree11f17765fac9ce9a9b3084577dfc56626303ac42 /Source/cmDependsC.cxx
parentca90e8002bb0310f8af1db6eb6d4ae9e796b09ec (diff)
downloadCMake-dc43a3d2657ae30c52ea7e0e6a6419c54119a00b.zip
CMake-dc43a3d2657ae30c52ea7e0e6a6419c54119a00b.tar.gz
CMake-dc43a3d2657ae30c52ea7e0e6a6419c54119a00b.tar.bz2
ENH: string += is very slow, so don't use it
Diffstat (limited to 'Source/cmDependsC.cxx')
-rw-r--r--Source/cmDependsC.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 71d4598..056c13c 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -311,8 +311,10 @@ const char* cmDependsC::ParseFileName(const char* in, std::string& name)
// Parse the possibly quoted file name.
bool quoted = false;
+ char* buf = new char[strlen(in)+1];
+ char* pos = buf;
for(;*c && (quoted ||
- ((*c != ':' || name.size() == 1) && !isspace(*c))); ++c)
+ ((*c != ':' || pos > buf+1) && !isspace(*c))); ++c)
{
if(*c == '"')
{
@@ -320,14 +322,18 @@ const char* cmDependsC::ParseFileName(const char* in, std::string& name)
}
else if(!quoted && *c == '\\' && isspace(*(c+1)))
{
- name += *(++c);
+ *pos = *(++c);
+ pos++;
}
else
{
- name += *c;
+ *pos = *c;
+ pos++;
}
}
-
+ *pos =0;
+ name += pos;
+ delete [] buf;
// Return the ending position.
return c;
}