From b53cd6fd8b8f32d0aaebed6e8d33f5dc536405a8 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Tue, 22 Oct 2024 09:25:15 +0200 Subject: [PATCH] util: refine try_read --- src/uvw/util.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uvw/util.h b/src/uvw/util.h index a6e4ffb3..efed2f46 100644 --- a/src/uvw/util.h +++ b/src/uvw/util.h @@ -250,14 +250,14 @@ namespace details { static constexpr std::size_t DEFAULT_SIZE = 128; template -std::string try_read(F &&f, Args &&...args) noexcept { +std::string try_read(F &&f, Args &&...args) { std::size_t size = DEFAULT_SIZE; char buf[DEFAULT_SIZE]; std::string str{}; auto err = std::forward(f)(args..., buf, &size); if(UV_ENOBUFS == err) { - std::unique_ptr data{new char[size]}; + auto data = std::make_unique(size); err = std::forward(f)(args..., data.get(), &size); if(0 == err) { @@ -424,7 +424,7 @@ struct utilities { * * @return The accessible subset of the password file entry. */ - static passwd_info passwd() noexcept; + static passwd_info passwd(); /** * @brief Retrieves the scheduling priority of a process.