From 571f36f1b61d316a2f2ace00fa94ba83ab1ac0a0 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Mon, 18 Jun 2018 18:54:54 +0200 Subject: =?UTF-8?q?Run=20clang-tidy=E2=80=99s=20modernize-pass-by-value=20?= =?UTF-8?q?pass.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This avoids having to pass variables by reference before copying them when calling a constructor. --- src/util/ege-tags.cpp | 11 ++++++----- src/util/ege-tags.h | 4 ++-- src/util/units.cpp | 17 +++++++++-------- src/util/units.h | 8 ++++---- src/util/ziptool.cpp | 9 +++++---- src/util/ziptool.h | 4 ++-- 6 files changed, 28 insertions(+), 25 deletions(-) (limited to 'src/util') diff --git a/src/util/ege-tags.cpp b/src/util/ege-tags.cpp index 3b9f68df8..f3955129a 100644 --- a/src/util/ege-tags.cpp +++ b/src/util/ege-tags.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include "ege-tags.h" @@ -55,9 +56,9 @@ namespace ege { -Label::Label(std::string const& lang, std::string const& value) : - lang(lang), - value(value) +Label::Label(std::string lang, std::string value) : + lang(std::move(lang)), + value(std::move(value)) { } @@ -69,8 +70,8 @@ Label::~Label() Tag::~Tag() = default; -Tag::Tag(std::string const& key) : - key(key) +Tag::Tag(std::string key) : + key(std::move(key)) { } diff --git a/src/util/ege-tags.h b/src/util/ege-tags.h index 7280e1f6a..a481c97e1 100644 --- a/src/util/ege-tags.h +++ b/src/util/ege-tags.h @@ -54,7 +54,7 @@ class Label { public: Label(); - Label(std::string const& lang, std::string const& value); + Label(std::string lang, std::string value); ~Label(); std::string lang; @@ -65,7 +65,7 @@ class Tag { public: Tag(); - Tag(std::string const& key); + Tag(std::string key); ~Tag(); std::string key; diff --git a/src/util/units.cpp b/src/util/units.cpp index ffa2681c6..340d3f697 100644 --- a/src/util/units.cpp +++ b/src/util/units.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -164,16 +165,16 @@ Unit::Unit() : Unit::Unit(UnitType type, double factor, - Glib::ustring const &name, - Glib::ustring const &name_plural, - Glib::ustring const &abbr, - Glib::ustring const &description) + Glib::ustring name, + Glib::ustring name_plural, + Glib::ustring abbr, + Glib::ustring description) : type(type) , factor(factor) - , name(name) - , name_plural(name_plural) - , abbr(abbr) - , description(description) + , name(std::move(name)) + , name_plural(std::move(name_plural)) + , abbr(std::move(abbr)) + , description(std::move(description)) { g_return_if_fail(factor <= 0); } diff --git a/src/util/units.h b/src/util/units.h index fa70058ba..e4530d0c3 100644 --- a/src/util/units.h +++ b/src/util/units.h @@ -43,10 +43,10 @@ public: Unit(); Unit(UnitType type, double factor, - Glib::ustring const &name, - Glib::ustring const &name_plural, - Glib::ustring const &abbr, - Glib::ustring const &description); + Glib::ustring name, + Glib::ustring name_plural, + Glib::ustring abbr, + Glib::ustring description); void clear(); diff --git a/src/util/ziptool.cpp b/src/util/ziptool.cpp index fe64bad6f..4408c3daa 100644 --- a/src/util/ziptool.cpp +++ b/src/util/ziptool.cpp @@ -36,6 +36,7 @@ #include #include +#include #include "ziptool.h" @@ -1903,11 +1904,11 @@ ZipEntry::ZipEntry() : /** * */ -ZipEntry::ZipEntry(const std::string &fileNameArg, - const std::string &commentArg) : +ZipEntry::ZipEntry(std::string fileNameArg, + std::string commentArg) : crc (0L), - fileName (fileNameArg), - comment (commentArg), + fileName (std::move(fileNameArg)), + comment (std::move(commentArg)), compressionMethod (8), compressedData (), uncompressedData (), diff --git a/src/util/ziptool.h b/src/util/ziptool.h index dbae8ac60..bcaec11f6 100644 --- a/src/util/ziptool.h +++ b/src/util/ziptool.h @@ -251,8 +251,8 @@ public: /** * */ - ZipEntry(const std::string &fileName, - const std::string &comment); + ZipEntry(std::string fileName, + std::string comment); /** * -- cgit v1.2.3