Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3356ca30 authored by Chih-hung Hsieh's avatar Chih-hung Hsieh Committed by Gerrit Code Review
Browse files

Merge "Add noexcept to move constructors and assignment operators."

parents 5f2a21d2 747eb149
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -42,14 +42,14 @@ struct Block {
    }

    Block(const Block& copy) = delete;
    Block(Block&& move) {
    Block(Block&& move) noexcept {
        std::swap(data_, move.data_);
        std::swap(capacity_, move.capacity_);
        std::swap(size_, move.size_);
    }

    Block& operator=(const Block& copy) = delete;
    Block& operator=(Block&& move) {
    Block& operator=(Block&& move) noexcept {
        clear();

        std::swap(data_, move.data_);
@@ -147,12 +147,10 @@ struct IOVector {
    }

    IOVector(const IOVector& copy) = delete;
    IOVector(IOVector&& move) : IOVector() {
        *this = std::move(move);
    }
    IOVector(IOVector&& move) noexcept : IOVector() { *this = std::move(move); }

    IOVector& operator=(const IOVector& copy) = delete;
    IOVector& operator=(IOVector&& move) {
    IOVector& operator=(IOVector&& move) noexcept {
        chain_ = std::move(move.chain_);
        chain_length_ = move.chain_length_;
        begin_offset_ = move.begin_offset_;
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ class ScopeGuard {
 public:
  ScopeGuard(F&& f) : f_(std::forward<F>(f)), active_(true) {}

  ScopeGuard(ScopeGuard&& that) : f_(std::move(that.f_)), active_(that.active_) {
  ScopeGuard(ScopeGuard&& that) noexcept : f_(std::move(that.f_)), active_(that.active_) {
    that.active_ = false;
  }

+2 −2
Original line number Diff line number Diff line
@@ -90,8 +90,8 @@ class unique_fd_impl final {
  explicit unique_fd_impl(int fd) { reset(fd); }
  ~unique_fd_impl() { reset(); }

  unique_fd_impl(unique_fd_impl&& other) { reset(other.release()); }
  unique_fd_impl& operator=(unique_fd_impl&& s) {
  unique_fd_impl(unique_fd_impl&& other) noexcept { reset(other.release()); }
  unique_fd_impl& operator=(unique_fd_impl&& s) noexcept {
    int fd = s.fd_;
    s.fd_ = -1;
    reset(fd, &s);
+3 −2
Original line number Diff line number Diff line
@@ -59,7 +59,8 @@ class TempDevice {
        : dm_(DeviceMapper::Instance()), name_(name), valid_(false) {
        valid_ = dm_.CreateDevice(name, table);
    }
    TempDevice(TempDevice&& other) : dm_(other.dm_), name_(other.name_), valid_(other.valid_) {
    TempDevice(TempDevice&& other) noexcept
        : dm_(other.dm_), name_(other.name_), valid_(other.valid_) {
        other.valid_ = false;
    }
    ~TempDevice() {
@@ -103,7 +104,7 @@ class TempDevice {
    TempDevice(const TempDevice&) = delete;
    TempDevice& operator=(const TempDevice&) = delete;

    TempDevice& operator=(TempDevice&& other) {
    TempDevice& operator=(TempDevice&& other) noexcept {
        name_ = other.name_;
        valid_ = other.valid_;
        other.valid_ = false;
+4 −4
Original line number Diff line number Diff line
@@ -47,9 +47,9 @@ class EventHandler {
  public:
    EventHandler();
    EventHandler(const EventHandler&) = delete;
    EventHandler(EventHandler&&);
    EventHandler(EventHandler&&) noexcept;
    EventHandler& operator=(const EventHandler&) = delete;
    EventHandler& operator=(EventHandler&&);
    EventHandler& operator=(EventHandler&&) noexcept;
    ~EventHandler() noexcept;

    bool init();
@@ -64,11 +64,11 @@ class EventHandler {

EventHandler::EventHandler() : fd_(-1) {}

EventHandler::EventHandler(EventHandler&& rval) : fd_(rval.fd_) {
EventHandler::EventHandler(EventHandler&& rval) noexcept : fd_(rval.fd_) {
    rval.fd_ = -1;
}

EventHandler& EventHandler::operator=(EventHandler&& rval) {
EventHandler& EventHandler::operator=(EventHandler&& rval) noexcept {
    fd_ = rval.fd_;
    rval.fd_ = -1;
    return *this;
Loading