From d9cd5fef8f8e393fcf70a286ce518542d642cd3d Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 12 Mar 2015 19:40:10 +0000 Subject: [PATCH] Avoid calling real_path when not needed in BufferManager::get_buffer_ifp --- src/buffer_manager.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/buffer_manager.cc b/src/buffer_manager.cc index db3e37c5..996eafd2 100644 --- a/src/buffer_manager.cc +++ b/src/buffer_manager.cc @@ -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;