From: Arvin Schnell Date: Fri, 18 Sep 2020 21:05:36 +0000 (+0200) Subject: - coding style X-Git-Tag: v0.8.14~4^2 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=96fa2bdb90c9688bfc81912501d79fcebcfb11fe;p=thirdparty%2Fsnapper.git - coding style --- diff --git a/client/cleanup.cc b/client/cleanup.cc index 2a9d2fae..2119e047 100644 --- a/client/cleanup.cc +++ b/client/cleanup.cc @@ -73,8 +73,8 @@ Parameters::Parameters(const ProxySnapper* snapper) ostream& operator<<(ostream& s, const Parameters& parameters) { - return s << "min-age:" << parameters.min_age << endl - << "space-limit:" << parameters.space_limit + return s << "min-age:" << parameters.min_age << '\n' + << "space-limit:" << parameters.space_limit << '\n' << "free-limit:" << parameters.free_limit; } @@ -93,7 +93,7 @@ public: protected: virtual list calculate_candidates(ProxySnapshots& snapshots, - Range::Value value) = 0; + const Range::Value& value) = 0; struct younger_than { @@ -134,8 +134,8 @@ protected: void cleanup(ProxySnapshots& snapshots, std::function condition); ProxySnapper* snapper; - bool verbose; + const bool verbose; const Parameters& parameters; }; @@ -263,7 +263,7 @@ Cleaner::is_quota_satisfied() const #ifdef VERBOSE_LOGGING cout << byte_to_humanstring(quota_data.size, 2) << ", " << byte_to_humanstring(quota_data.used, 2) << ", " - << fraction << ", " << satisfied << endl; + << fraction << ", " << satisfied << '\n'; #endif return satisfied; @@ -307,7 +307,7 @@ Cleaner::is_free_satisfied() const #ifdef VERBOSE_LOGGING cout << byte_to_humanstring(free_space_data.size, 2) << ", " << byte_to_humanstring(free_space_data.free, 2) << ", " - << fraction << ", " << satisfied << endl; + << fraction << ", " << satisfied << '\n'; #endif return satisfied; @@ -336,7 +336,7 @@ Cleaner::cleanup(ProxySnapshots& snapshots, std::function condition) // not enough candidates to satisfy the condition #ifdef VERBOSE_LOGGING - cout << "condition not satisfied" << endl; + cout << "condition not satisfied" << '\n'; #endif return; @@ -366,7 +366,7 @@ Cleaner::cleanup(ProxySnapshots& snapshots, std::function condition) // not enough candidates to satisfy the condition #ifdef VERBOSE_LOGGING - cout << "condition not satisfied" << endl; + cout << "condition not satisfied" << '\n'; #endif return; @@ -375,7 +375,7 @@ Cleaner::cleanup(ProxySnapshots& snapshots, std::function condition) } #ifdef VERBOSE_LOGGING - cout << "condition satisfied" << endl; + cout << "condition satisfied" << '\n'; #endif } @@ -386,7 +386,7 @@ Cleaner::cleanup() ProxySnapshots& snapshots = snapper->getSnapshots(); #ifdef VERBOSE_LOGGING - cout << "cleanup without condition" << endl; + cout << "cleanup without condition" << '\n'; #endif cleanup(snapshots); @@ -394,7 +394,7 @@ Cleaner::cleanup() if (is_quota_aware()) { #ifdef VERBOSE_LOGGING - cout << "cleanup with quota condition" << endl; + cout << "cleanup with quota condition" << '\n'; #endif cleanup(snapshots, std::bind(&Cleaner::is_quota_satisfied, this)); @@ -402,14 +402,14 @@ Cleaner::cleanup() else { #ifdef VERBOSE_LOGGING - cout << "no cleanup with quota condition" << endl; + cout << "no cleanup with quota condition" << '\n'; #endif } if (is_free_aware()) { #ifdef VERBOSE_LOGGING - cout << "cleanup with free condition" << endl; + cout << "cleanup with free condition" << '\n'; #endif cleanup(snapshots, std::bind(&Cleaner::is_free_satisfied, this)); @@ -417,7 +417,7 @@ Cleaner::cleanup() else { #ifdef VERBOSE_LOGGING - cout << "no cleanup with free condition" << endl; + cout << "no cleanup with free condition" << '\n'; #endif } } @@ -449,8 +449,8 @@ NumberParameters::NumberParameters(const ProxySnapper* snapper) ostream& operator<<(ostream& s, const NumberParameters& parameters) { - return s << dynamic_cast(parameters) << endl - << "limit:" << parameters.limit << endl + return s << dynamic_cast(parameters) << '\n' + << "limit:" << parameters.limit << '\n' << "limit-important:" << parameters.limit_important; } @@ -481,7 +481,7 @@ private: list - calculate_candidates(ProxySnapshots& snapshots, Range::Value value) override + calculate_candidates(ProxySnapshots& snapshots, const Range::Value& value) override { const NumberParameters& parameters = dynamic_cast(Cleaner::parameters); @@ -567,11 +567,11 @@ TimelineParameters::TimelineParameters(const ProxySnapper* snapper) ostream& operator<<(ostream& s, const TimelineParameters& parameters) { - return s << dynamic_cast(parameters) << endl - << "limit-hourly:" << parameters.limit_hourly << endl - << "limit-daily:" << parameters.limit_daily << endl - << "limit-weekly:" << parameters.limit_weekly << endl - << "limit-monthly:" << parameters.limit_monthly << endl + return s << dynamic_cast(parameters) << '\n' + << "limit-hourly:" << parameters.limit_hourly << '\n' + << "limit-daily:" << parameters.limit_daily << '\n' + << "limit-weekly:" << parameters.limit_weekly << '\n' + << "limit-monthly:" << parameters.limit_monthly << '\n' << "limit-yearly:" << parameters.limit_yearly; } @@ -666,7 +666,7 @@ private: list - calculate_candidates(ProxySnapshots& snapshots, Range::Value value) override + calculate_candidates(ProxySnapshots& snapshots, const Range::Value& value) override { const TimelineParameters& parameters = dynamic_cast(Cleaner::parameters); @@ -763,7 +763,7 @@ public: private: list - calculate_candidates(ProxySnapshots& snapshots, Range::Value value) override + calculate_candidates(ProxySnapshots& snapshots, const Range::Value& value) override { list ret; diff --git a/client/cmd-create.cc b/client/cmd-create.cc index bcd7bdef..8ba9561e 100644 --- a/client/cmd-create.cc +++ b/client/cmd-create.cc @@ -102,7 +102,6 @@ namespace snapper { string error = sformat(_("Unknown type '%s'."), opt->second.c_str()) + '\n' + possible_enum_values(); - SN_THROW(OptionsException(error)); } }