]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- coding style 567/head
authorArvin Schnell <aschnell@suse.de>
Fri, 18 Sep 2020 21:05:36 +0000 (23:05 +0200)
committerArvin Schnell <aschnell@suse.de>
Fri, 18 Sep 2020 21:05:36 +0000 (23:05 +0200)
client/cleanup.cc
client/cmd-create.cc

index 2a9d2fae1c21caf57b49d7451b02084fd74862b3..2119e04713e9ba4c7cd8434cdc6f35b796d69c96 100644 (file)
@@ -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<ProxySnapshots::iterator> 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<bool()> 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<bool()> 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<bool()> 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<bool()> 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<const Parameters&>(parameters) << endl
-            << "limit:" << parameters.limit << endl
+    return s << dynamic_cast<const Parameters&>(parameters) << '\n'
+            << "limit:" << parameters.limit << '\n'
             << "limit-important:" << parameters.limit_important;
 }
 
@@ -481,7 +481,7 @@ private:
 
 
     list<ProxySnapshots::iterator>
-    calculate_candidates(ProxySnapshots& snapshots, Range::Value value) override
+    calculate_candidates(ProxySnapshots& snapshots, const Range::Value& value) override
     {
        const NumberParameters& parameters = dynamic_cast<const NumberParameters&>(Cleaner::parameters);
 
@@ -567,11 +567,11 @@ TimelineParameters::TimelineParameters(const ProxySnapper* snapper)
 ostream&
 operator<<(ostream& s, const TimelineParameters& parameters)
 {
-    return s << dynamic_cast<const Parameters&>(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<const Parameters&>(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<ProxySnapshots::iterator>
-    calculate_candidates(ProxySnapshots& snapshots, Range::Value value) override
+    calculate_candidates(ProxySnapshots& snapshots, const Range::Value& value) override
     {
        const TimelineParameters& parameters = dynamic_cast<const TimelineParameters&>(Cleaner::parameters);
 
@@ -763,7 +763,7 @@ public:
 private:
 
     list<ProxySnapshots::iterator>
-    calculate_candidates(ProxySnapshots& snapshots, Range::Value value) override
+    calculate_candidates(ProxySnapshots& snapshots, const Range::Value& value) override
     {
        list<ProxySnapshots::iterator> ret;
 
index bcd7bdefb448a24abb1d6f8161b8a4ffa8e70275..8ba9561ed84d718e81b5567cec4a51966bbc2bbf 100644 (file)
@@ -102,7 +102,6 @@ namespace snapper
            {
                string error = sformat(_("Unknown type '%s'."), opt->second.c_str()) + '\n' +
                    possible_enum_values<CreateType>();
-
                SN_THROW(OptionsException(error));
            }
        }