mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 22:57:22 +00:00
Merge pull request #1559 from lioncash/vec
soc_u: Get rid of explicit delete and new
This commit is contained in:
commit
446d7c7e55
1 changed files with 5 additions and 8 deletions
|
@ -5,6 +5,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/bit_field.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)
|
// The 3ds_pollfd and the pollfd structures may be different (Windows/Linux have different sizes)
|
||||||
// so we have to copy the data
|
// so we have to copy the data
|
||||||
pollfd* platform_pollfd = new pollfd[nfds];
|
std::vector<pollfd> platform_pollfd(nfds);
|
||||||
for (unsigned current_fds = 0; current_fds < nfds; ++current_fds)
|
std::transform(input_fds, input_fds + nfds, platform_pollfd.begin(), CTRPollFD::ToPlatform);
|
||||||
platform_pollfd[current_fds] = CTRPollFD::ToPlatform(input_fds[current_fds]);
|
|
||||||
|
|
||||||
int ret = ::poll(platform_pollfd, nfds, timeout);
|
const int ret = ::poll(platform_pollfd.data(), nfds, timeout);
|
||||||
|
|
||||||
// Now update the output pollfd structure
|
// Now update the output pollfd structure
|
||||||
for (unsigned current_fds = 0; current_fds < nfds; ++current_fds)
|
std::transform(platform_pollfd.begin(), platform_pollfd.end(), output_fds, CTRPollFD::FromPlatform);
|
||||||
output_fds[current_fds] = CTRPollFD::FromPlatform(platform_pollfd[current_fds]);
|
|
||||||
|
|
||||||
delete[] platform_pollfd;
|
|
||||||
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (ret == SOCKET_ERROR_VALUE)
|
if (ret == SOCKET_ERROR_VALUE)
|
||||||
|
|
Loading…
Reference in a new issue