Skip to content
Snippets Groups Projects
Commit 55d1d6ab authored by Ben Boeckel's avatar Ben Boeckel Committed by Brad King
Browse files

CollapseFullPath: reserve space for components

The number of input components is a good hint for the number of output
components.
parent 3b46b7c0
No related branches found
No related tags found
No related merge requests found
......@@ -3200,6 +3200,7 @@ std::string SystemTools::CollapseFullPath(const std::string& in_path,
// Split the input path components.
std::vector<std::string> path_components;
SystemTools::SplitPath(in_path, path_components);
out_components.reserve(path_components.size());
// If the input path is relative, start with a base path.
if (path_components[0].empty()) {
......@@ -3262,6 +3263,7 @@ std::string SystemTools::CollapseFullPath(const std::string& in_path,
// Split the input path components.
std::vector<std::string> path_components;
SystemTools::SplitPath(in_path, path_components);
out_components.reserve(path_components.size());
// If the input path is relative, start with a base path.
if (path_components[0].length() == 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment