diff --git a/AK/LogStream.h b/AK/LogStream.h index 8eb7cca626..81480adfb6 100644 --- a/AK/LogStream.h +++ b/AK/LogStream.h @@ -3,7 +3,7 @@ #include #ifdef USERLAND -#include +#include #include #endif @@ -77,7 +77,7 @@ protected: private: #ifdef USERLAND - ValueRestorer m_errno_restorer; + ScopedValueRollback m_errno_restorer; #endif }; diff --git a/AK/ValueRestorer.h b/AK/ScopedValueRollback.h similarity index 66% rename from AK/ValueRestorer.h rename to AK/ScopedValueRollback.h index 99fa43e187..f84cabf6d4 100644 --- a/AK/ValueRestorer.h +++ b/AK/ScopedValueRollback.h @@ -3,15 +3,15 @@ namespace AK { template -class ValueRestorer { +class ScopedValueRollback { public: - ValueRestorer(T& variable) + ScopedValueRollback(T& variable) : m_variable(variable) , m_saved_value(variable) { } - ~ValueRestorer() + ~ScopedValueRollback() { m_variable = m_saved_value; } @@ -23,4 +23,4 @@ private: } -using AK::ValueRestorer; +using AK::ScopedValueRollback; diff --git a/Libraries/LibC/stdio.cpp b/Libraries/LibC/stdio.cpp index b1288a5780..05f60495ac 100644 --- a/Libraries/LibC/stdio.cpp +++ b/Libraries/LibC/stdio.cpp @@ -1,6 +1,6 @@ #include +#include #include -#include #include #include #include @@ -510,7 +510,7 @@ FILE* popen(const char* command, const char* type) int rc = pipe(pipe_fds); if (rc < 0) { - ValueRestorer restorer(errno); + ScopedValueRollback rollback(errno); perror("pipe"); return nullptr; }