From 027a5249071236d3e8ea29f1c4267a5b647dfde9 Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Tue, 7 Apr 2020 08:55:34 +1000 Subject: [PATCH] Remove unnecessary null pointer checks. --- .../asio/detail/impl/winrt_ssocket_service_base.ipp | 8 ++------ asio/include/asio/detail/thread_info_base.hpp | 3 +-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/asio/include/asio/detail/impl/winrt_ssocket_service_base.ipp b/asio/include/asio/detail/impl/winrt_ssocket_service_base.ipp index c193c6b5..66d3f776 100644 --- a/asio/include/asio/detail/impl/winrt_ssocket_service_base.ipp +++ b/asio/include/asio/detail/impl/winrt_ssocket_service_base.ipp @@ -139,12 +139,8 @@ asio::error_code winrt_ssocket_service_base::close( winrt_ssocket_service_base::base_implementation_type& impl, asio::error_code& ec) { - if (impl.socket_) - { - delete impl.socket_; - impl.socket_ = nullptr; - } - + delete impl.socket_; + impl.socket_ = nullptr; ec = asio::error_code(); return ec; } diff --git a/asio/include/asio/detail/thread_info_base.hpp b/asio/include/asio/detail/thread_info_base.hpp index f8f727db..ceb85f10 100644 --- a/asio/include/asio/detail/thread_info_base.hpp +++ b/asio/include/asio/detail/thread_info_base.hpp @@ -52,8 +52,7 @@ public: ~thread_info_base() { for (int i = 0; i < max_mem_index; ++i) - if (reusable_memory_[i]) - ::operator delete(reusable_memory_[i]); + ::operator delete(reusable_memory_[i]); } static void* allocate(thread_info_base* this_thread, std::size_t size)