Browse Source

Additional fixes of clang-tidy's performance warnings

merge-requests/382/head
eidheim 8 years ago
parent
commit
521e563997
  1. 2
      src/filesystem.cc
  2. 6
      src/git.cc
  3. 5
      src/source_spellcheck.cc

2
src/filesystem.cc

@ -187,7 +187,7 @@ boost::filesystem::path filesystem::get_executable(const boost::filesystem::path
return executable_name; return executable_name;
} }
auto executable_name_str = executable_name.string(); auto &executable_name_str = executable_name.string();
for(auto &path: bin_paths) { for(auto &path: bin_paths) {
boost::filesystem::path executable; boost::filesystem::path executable;
for(boost::filesystem::directory_iterator it(path), end; it != end; ++it) { for(boost::filesystem::directory_iterator it(path), end; it != end; ++it) {

6
src/git.cc

@ -98,8 +98,7 @@ Git::Repository::Repository(const boost::filesystem::path &path) {
{ {
Error error; Error error;
std::lock_guard<std::mutex> lock(mutex); std::lock_guard<std::mutex> lock(mutex);
auto path_str=path.generic_string(); error.code = git_repository_open_ext(&repository_ptr, path.generic_string().c_str(), 0, nullptr);
error.code = git_repository_open_ext(&repository_ptr, path_str.c_str(), 0, nullptr);
if(error) if(error)
throw std::runtime_error(error.message()); throw std::runtime_error(error.message());
} }
@ -229,8 +228,7 @@ boost::filesystem::path Git::Repository::get_root_path(const boost::filesystem::
{ {
Error error; Error error;
std::lock_guard<std::mutex> lock(mutex); std::lock_guard<std::mutex> lock(mutex);
auto path_str=path.generic_string(); error.code = git_repository_discover(&root, path.generic_string().c_str(), 0, nullptr);
error.code = git_repository_discover(&root, path_str.c_str(), 0, nullptr);
if(error) if(error)
throw std::runtime_error(error.message()); throw std::runtime_error(error.message());
} }

5
src/source_spellcheck.cc

@ -66,12 +66,11 @@ Source::SpellCheckView::SpellCheckView(const boost::filesystem::path &file_path,
if(!iter.starts_line() && !iter.ends_line() && is_word_iter(iter) && if(!iter.starts_line() && !iter.ends_line() && is_word_iter(iter) &&
previous_iter.backward_char() && !previous_iter.starts_line() && !is_word_iter(previous_iter)) { previous_iter.backward_char() && !previous_iter.starts_line() && !is_word_iter(previous_iter)) {
auto first=previous_iter; auto first=previous_iter;
auto second=iter;
if(first.backward_char()) { if(first.backward_char()) {
get_buffer()->remove_tag(spellcheck_error_tag, first, second); get_buffer()->remove_tag(spellcheck_error_tag, first, iter);
auto word=get_word(first); auto word=get_word(first);
spellcheck_word(word.first, word.second); spellcheck_word(word.first, word.second);
word=get_word(second); word=get_word(iter);
spellcheck_word(word.first, word.second); spellcheck_word(word.first, word.second);
} }
} }

Loading…
Cancel
Save