forked from qt-creator/qt-creator
Clang: Fix reserves for clangpathwatcher
Change-Id: Ib097ea48e913df052e5a87bf886b2173e0d52358 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -315,6 +315,7 @@ unittest_public:
|
|||||||
WatcherEntries uniquePaths(const WatcherEntries &pathEntries)
|
WatcherEntries uniquePaths(const WatcherEntries &pathEntries)
|
||||||
{
|
{
|
||||||
WatcherEntries uniqueEntries;
|
WatcherEntries uniqueEntries;
|
||||||
|
uniqueEntries.reserve(pathEntries.size());
|
||||||
|
|
||||||
auto compare = [] (const WatcherEntry &first, const WatcherEntry &second) {
|
auto compare = [] (const WatcherEntry &first, const WatcherEntry &second) {
|
||||||
return first.pathId == second.pathId;
|
return first.pathId == second.pathId;
|
||||||
@@ -381,6 +382,7 @@ unittest_public:
|
|||||||
FilePathIds pathIds = m_pathCache.filePathIds(filePaths);
|
FilePathIds pathIds = m_pathCache.filePathIds(filePaths);
|
||||||
|
|
||||||
WatcherEntries foundEntries;
|
WatcherEntries foundEntries;
|
||||||
|
foundEntries.reserve(pathIds.size());
|
||||||
|
|
||||||
for (FilePathId pathId : pathIds) {
|
for (FilePathId pathId : pathIds) {
|
||||||
auto range = std::equal_range(m_watchedEntries.begin(), m_watchedEntries.end(), pathId);
|
auto range = std::equal_range(m_watchedEntries.begin(), m_watchedEntries.end(), pathId);
|
||||||
@@ -393,6 +395,7 @@ unittest_public:
|
|||||||
Utils::SmallStringVector idsForWatcherEntries(const WatcherEntries &foundEntries)
|
Utils::SmallStringVector idsForWatcherEntries(const WatcherEntries &foundEntries)
|
||||||
{
|
{
|
||||||
Utils::SmallStringVector ids;
|
Utils::SmallStringVector ids;
|
||||||
|
ids.reserve(foundEntries.size());
|
||||||
|
|
||||||
std::transform(foundEntries.begin(),
|
std::transform(foundEntries.begin(),
|
||||||
foundEntries.end(),
|
foundEntries.end(),
|
||||||
|
|||||||
Reference in New Issue
Block a user