From 9ea3d552431c706f2506794dbdc4c0b683c69632 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 21 Mar 2016 01:21:48 -0400 Subject: [PATCH] soc_u: Get rid of explicit delete and new --- src/core/hle/service/soc_u.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp index b52e52d4a..ff0af8f12 100644 --- a/src/core/hle/service/soc_u.cpp +++ b/src/core/hle/service/soc_u.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "common/assert.h" #include "common/bit_field.h" @@ -593,17 +594,13 @@ static void Poll(Service::Interface* self) { // The 3ds_pollfd and the pollfd structures may be different (Windows/Linux have different sizes) // so we have to copy the data - pollfd* platform_pollfd = new pollfd[nfds]; - for (unsigned current_fds = 0; current_fds < nfds; ++current_fds) - platform_pollfd[current_fds] = CTRPollFD::ToPlatform(input_fds[current_fds]); + std::vector platform_pollfd(nfds); + std::transform(input_fds, input_fds + nfds, platform_pollfd.begin(), CTRPollFD::ToPlatform); - int ret = ::poll(platform_pollfd, nfds, timeout); + const int ret = ::poll(platform_pollfd.data(), nfds, timeout); // Now update the output pollfd structure - for (unsigned current_fds = 0; current_fds < nfds; ++current_fds) - output_fds[current_fds] = CTRPollFD::FromPlatform(platform_pollfd[current_fds]); - - delete[] platform_pollfd; + std::transform(platform_pollfd.begin(), platform_pollfd.end(), output_fds, CTRPollFD::FromPlatform); int result = 0; if (ret == SOCKET_ERROR_VALUE)