forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibC: Implement popen() and pclose().
I feel reasonably confident that I might have gotten these right. :^)
- Loading branch information
1 parent
e92fe52
commit ccc6e69
Showing
3 changed files
with
89 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#pragma once | ||
|
||
namespace AK { | ||
|
||
template<typename T> | ||
class ValueRestorer { | ||
public: | ||
ValueRestorer(T& variable) | ||
: m_variable(variable) | ||
, m_saved_value(variable) | ||
{ | ||
} | ||
|
||
~ValueRestorer() | ||
{ | ||
m_variable = m_saved_value; | ||
} | ||
|
||
private: | ||
T& m_variable; | ||
T m_saved_value; | ||
}; | ||
|
||
} | ||
|
||
using AK::ValueRestorer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters