Avoid calling real_path when not needed in BufferManager::get_buffer_ifp

This commit is contained in:
Maxime Coste 2015-03-12 19:40:10 +00:00
parent c57e76ee41
commit d9cd5fef8f

View File

@ -78,11 +78,11 @@ void BufferManager::delete_buffer_if_exists(StringView name)
Buffer* BufferManager::get_buffer_ifp(StringView name)
{
auto path = real_path(parse_filename(name));
for (auto& buf : m_buffers)
{
if (buf->name() == name or
(buf->flags() & Buffer::Flags::File and
real_path(buf->name()) == real_path(parse_filename(name))))
(buf->flags() & Buffer::Flags::File and buf->name() == path))
return buf.get();
}
return nullptr;