system/FileDescriptor: use std::exchange()
This commit is contained in:
parent
31bad5f7af
commit
8c832f4c50
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue