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

system/FileDescriptor: use std::exchange()

parent 31bad5f7
......@@ -33,6 +33,8 @@
#include "check.h"
#include "Compiler.h"
#include <utility>
#include <assert.h>
#include <unistd.h>
#include <sys/types.h>
......@@ -75,11 +77,7 @@ public:
}
int Steal() noexcept {
assert(IsDefined());
int _fd = fd;
fd = -1;
return _fd;
return std::exchange(fd, -1);
}
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