diff --git a/src/io/uring/Ring.cxx b/src/io/uring/Ring.cxx index 91331a523..5592f54ae 100644 --- a/src/io/uring/Ring.cxx +++ b/src/io/uring/Ring.cxx @@ -9,24 +9,24 @@ namespace Uring { Ring::Ring(unsigned entries, unsigned flags) { - int error = io_uring_queue_init(entries, &ring, flags); - if (error < 0) + if (int error = io_uring_queue_init(entries, &ring, flags); + error < 0) throw MakeErrno(-error, "io_uring_queue_init() failed"); } void Ring::Submit() { - int error = io_uring_submit(&ring); - if (error < 0) + if (int error = io_uring_submit(&ring); + error < 0) throw MakeErrno(-error, "io_uring_submit() failed"); } void Ring::SubmitAndGetEvents() { - int error = io_uring_submit_and_get_events(&ring); - if (error < 0) + if (int error = io_uring_submit_and_get_events(&ring); + error < 0) throw MakeErrno(-error, "io_uring_submit() failed"); } @@ -34,8 +34,8 @@ struct io_uring_cqe * Ring::WaitCompletion() { struct io_uring_cqe *cqe; - int error = io_uring_wait_cqe(&ring, &cqe); - if (error < 0) { + if (int error = io_uring_wait_cqe(&ring, &cqe); + error < 0) { if (error == -EAGAIN) return nullptr; @@ -49,8 +49,7 @@ struct io_uring_cqe * Ring::PeekCompletion() { struct io_uring_cqe *cqe; - int error = io_uring_peek_cqe(&ring, &cqe); - if (error < 0) { + if (int error = io_uring_peek_cqe(&ring, &cqe); error < 0) { if (error == -EAGAIN) return nullptr;