Commit 8c832f4c authored by Max Kellermann's avatar Max Kellermann

system/FileDescriptor: use std::exchange()

parent 31bad5f7
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include "check.h" #include "check.h"
#include "Compiler.h" #include "Compiler.h"
#include <utility>
#include <assert.h> #include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
...@@ -75,11 +77,7 @@ public: ...@@ -75,11 +77,7 @@ public:
} }
int Steal() noexcept { int Steal() noexcept {
assert(IsDefined()); return std::exchange(fd, -1);
int _fd = fd;
fd = -1;
return _fd;
} }
void SetUndefined() noexcept { void SetUndefined() noexcept {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment