summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/soc_u.cpp13
1 files 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 @@
5#include <algorithm> 5#include <algorithm>
6#include <cstring> 6#include <cstring>
7#include <unordered_map> 7#include <unordered_map>
8#include <vector>
8 9
9#include "common/assert.h" 10#include "common/assert.h"
10#include "common/bit_field.h" 11#include "common/bit_field.h"
@@ -593,17 +594,13 @@ static void Poll(Service::Interface* self) {
593 594
594 // The 3ds_pollfd and the pollfd structures may be different (Windows/Linux have different sizes) 595 // The 3ds_pollfd and the pollfd structures may be different (Windows/Linux have different sizes)
595 // so we have to copy the data 596 // so we have to copy the data
596 pollfd* platform_pollfd = new pollfd[nfds]; 597 std::vector<pollfd> platform_pollfd(nfds);
597 for (unsigned current_fds = 0; current_fds < nfds; ++current_fds) 598 std::transform(input_fds, input_fds + nfds, platform_pollfd.begin(), CTRPollFD::ToPlatform);
598 platform_pollfd[current_fds] = CTRPollFD::ToPlatform(input_fds[current_fds]);
599 599
600 int ret = ::poll(platform_pollfd, nfds, timeout); 600 const int ret = ::poll(platform_pollfd.data(), nfds, timeout);
601 601
602 // Now update the output pollfd structure 602 // Now update the output pollfd structure
603 for (unsigned current_fds = 0; current_fds < nfds; ++current_fds) 603 std::transform(platform_pollfd.begin(), platform_pollfd.end(), output_fds, CTRPollFD::FromPlatform);
604 output_fds[current_fds] = CTRPollFD::FromPlatform(platform_pollfd[current_fds]);
605
606 delete[] platform_pollfd;
607 604
608 int result = 0; 605 int result = 0;
609 if (ret == SOCKET_ERROR_VALUE) 606 if (ret == SOCKET_ERROR_VALUE)