summaryrefslogtreecommitdiffstats
path: root/Source/bindexplib.cxx
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2020-03-21 11:51:46 (GMT)
committerRolf Eike Beer <eike@sf-mail.de>2020-03-23 21:41:44 (GMT)
commitef778d77e0795ecba8af55a6984ad5fa5f44377a (patch)
treef2256f9fac53cc2be8840bc69cf1f8feb32c17f6 /Source/bindexplib.cxx
parent77616f46817b6527c7e515de547625e554df21f9 (diff)
downloadCMake-ef778d77e0795ecba8af55a6984ad5fa5f44377a.zip
CMake-ef778d77e0795ecba8af55a6984ad5fa5f44377a.tar.gz
CMake-ef778d77e0795ecba8af55a6984ad5fa5f44377a.tar.bz2
replace std::string::substr() with operations that do not allocate memory
Modify the original string instead of creating a new copy with substr() when it is not used for anything else afterwards.
Diffstat (limited to 'Source/bindexplib.cxx')
-rw-r--r--Source/bindexplib.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index 0b2750d..fdfd4c0 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -352,14 +352,14 @@ bool DumpFileWithLlvmNm(std::string const& nmPath, const char* filename,
line.c_str());
return false;
}
- const std::string sym = line.substr(0, sym_end);
const char sym_type = line[sym_end + 1];
+ line.resize(sym_end);
switch (sym_type) {
case 'D':
- dataSymbols.insert(sym);
+ dataSymbols.insert(line);
break;
case 'T':
- symbols.insert(sym);
+ symbols.insert(line);
break;
}
}