From 68dfd6aa3a72f8eca9f0306b730e90ccbf10fcc5 Mon Sep 17 00:00:00 2001 From: Tamino Bauknecht Date: Mon, 23 Oct 2023 14:59:46 +0200 Subject: [PATCH] scope_guard/modules: Rename scope_guard to ScopeGuard Using pascal case for the class name keeps it more consistent with the majority of the other class names. --- include/util/scope_guard.hpp | 14 +++++++------- src/modules/bluetooth.cpp | 2 +- src/modules/custom.cpp | 2 +- src/modules/mpris/mpris.cpp | 6 +++--- src/modules/sni/host.cpp | 4 ++-- src/modules/sni/watcher.cpp | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/util/scope_guard.hpp b/include/util/scope_guard.hpp index 5c717704..0d78cad6 100644 --- a/include/util/scope_guard.hpp +++ b/include/util/scope_guard.hpp @@ -5,14 +5,14 @@ namespace waybar::util { template -class scope_guard { +class ScopeGuard { public: - explicit scope_guard(Func&& exit_function) : f{std::forward(exit_function)} {} - scope_guard(const scope_guard&) = delete; - scope_guard(scope_guard&&) = default; - scope_guard& operator=(const scope_guard&) = delete; - scope_guard& operator=(scope_guard&&) = default; - ~scope_guard() { f(); } + explicit ScopeGuard(Func&& exit_function) : f{std::forward(exit_function)} {} + ScopeGuard(const ScopeGuard&) = delete; + ScopeGuard(ScopeGuard&&) = default; + ScopeGuard& operator=(const ScopeGuard&) = delete; + ScopeGuard& operator=(ScopeGuard&&) = default; + ~ScopeGuard() { f(); } private: Func f; diff --git a/src/modules/bluetooth.cpp b/src/modules/bluetooth.cpp index 6b6cb7ef..80e4731b 100644 --- a/src/modules/bluetooth.cpp +++ b/src/modules/bluetooth.cpp @@ -14,7 +14,7 @@ using GDBusManager = std::unique_ptr GDBusManager { GError* error = nullptr; - waybar::util::scope_guard error_deleter([error]() { + waybar::util::ScopeGuard error_deleter([error]() { if (error) { g_error_free(error); } diff --git a/src/modules/custom.cpp b/src/modules/custom.cpp index d0a39802..287b5588 100644 --- a/src/modules/custom.cpp +++ b/src/modules/custom.cpp @@ -59,7 +59,7 @@ void waybar::modules::Custom::continuousWorker() { } thread_ = [this, cmd] { char* buff = nullptr; - waybar::util::scope_guard buff_deleter([buff]() { + waybar::util::ScopeGuard buff_deleter([buff]() { if (buff) { free(buff); } diff --git a/src/modules/mpris/mpris.cpp b/src/modules/mpris/mpris.cpp index 02138af7..feb1f60f 100644 --- a/src/modules/mpris/mpris.cpp +++ b/src/modules/mpris/mpris.cpp @@ -119,7 +119,7 @@ Mpris::Mpris(const std::string& id, const Json::Value& config) } GError* error = nullptr; - waybar::util::scope_guard error_deleter([error]() { + waybar::util::ScopeGuard error_deleter([error]() { if (error) { g_error_free(error); } @@ -482,7 +482,7 @@ auto Mpris::getPlayerInfo() -> std::optional { } GError* error = nullptr; - waybar::util::scope_guard error_deleter([error]() { + waybar::util::ScopeGuard error_deleter([error]() { if (error) { g_error_free(error); } @@ -580,7 +580,7 @@ errorexit: bool Mpris::handleToggle(GdkEventButton* const& e) { GError* error = nullptr; - waybar::util::scope_guard error_deleter([error]() { + waybar::util::ScopeGuard error_deleter([error]() { if (error) { g_error_free(error); } diff --git a/src/modules/sni/host.cpp b/src/modules/sni/host.cpp index 136c2941..54faa16c 100644 --- a/src/modules/sni/host.cpp +++ b/src/modules/sni/host.cpp @@ -59,7 +59,7 @@ void Host::nameVanished(const Glib::RefPtr& conn, const G void Host::proxyReady(GObject* src, GAsyncResult* res, gpointer data) { GError* error = nullptr; - waybar::util::scope_guard error_deleter([error]() { + waybar::util::ScopeGuard error_deleter([error]() { if (error != nullptr) { g_error_free(error); } @@ -81,7 +81,7 @@ void Host::proxyReady(GObject* src, GAsyncResult* res, gpointer data) { void Host::registerHost(GObject* src, GAsyncResult* res, gpointer data) { GError* error = nullptr; - waybar::util::scope_guard error_deleter([error]() { + waybar::util::ScopeGuard error_deleter([error]() { if (error != nullptr) { g_error_free(error); } diff --git a/src/modules/sni/watcher.cpp b/src/modules/sni/watcher.cpp index 22434709..8c035ae1 100644 --- a/src/modules/sni/watcher.cpp +++ b/src/modules/sni/watcher.cpp @@ -31,7 +31,7 @@ Watcher::~Watcher() { void Watcher::busAcquired(const Glib::RefPtr& conn, Glib::ustring name) { GError* error = nullptr; - waybar::util::scope_guard error_deleter([error]() { + waybar::util::ScopeGuard error_deleter([error]() { if (error) { g_error_free(error); }