[hle/bsd] do not use rust-result wannabe Expected in functions (#4075)

rust has Result<T,E> but we don't really need that in c++, also the header just sucks, objectively

Signed-off-by: lizzie lizzie@eden-emu.dev

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4075
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Reviewed-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
lizzie
2026-06-27 08:50:24 +02:00
committed by crueter
parent 81c6e56713
commit d8a8169eb2
9 changed files with 60 additions and 1049 deletions
+3 -5
View File
@@ -28,7 +28,6 @@
#include "common/assert.h"
#include "common/common_types.h"
#include "common/expected.h"
#include "common/logging.h"
#include "common/settings.h"
#include "core/internal_network/network.h"
@@ -733,15 +732,14 @@ u32 IPv4AddressToInteger(IPv4Address ip_addr) {
static_cast<u32>(ip_addr[2]) << 8 | static_cast<u32>(ip_addr[3]);
}
Common::Expected<std::vector<AddrInfo>, GetAddrInfoError> GetAddressInfo(
std::variant<std::vector<AddrInfo>, GetAddrInfoError> GetAddressInfo(
const std::string& host, const std::optional<std::string>& service) {
addrinfo hints{};
hints.ai_family = AF_INET; // Switch only supports IPv4.
addrinfo* addrinfo;
s32 gai_err = getaddrinfo(host.c_str(), service.has_value() ? service->c_str() : nullptr,
&hints, &addrinfo);
s32 gai_err = getaddrinfo(host.c_str(), service.has_value() ? service->c_str() : nullptr, &hints, &addrinfo);
if (gai_err != 0) {
return Common::Unexpected(TranslateGetAddrInfoErrorFromNative(gai_err));
return TranslateGetAddrInfoErrorFromNative(gai_err);
}
std::vector<AddrInfo> ret;
for (auto* current = addrinfo; current; current = current->ai_next) {
+2 -2
View File
@@ -9,6 +9,7 @@
#include <array>
#include <optional>
#include <vector>
#include <variant>
#include "common/common_funcs.h"
#include "common/common_types.h"
@@ -124,7 +125,6 @@ std::string IPv4AddressToString(IPv4Address ip_addr);
u32 IPv4AddressToInteger(IPv4Address ip_addr);
// named to avoid name collision with Windows macro
Common::Expected<std::vector<AddrInfo>, GetAddrInfoError> GetAddressInfo(
const std::string& host, const std::optional<std::string>& service);
std::variant<std::vector<AddrInfo>, GetAddrInfoError> GetAddressInfo(const std::string& host, const std::optional<std::string>& service);
} // namespace Network