From 4778aeab1ed37e2a1e4e94d10c00c5fcd1005aba Mon Sep 17 00:00:00 2001 From: RadWolfie Date: Thu, 15 Apr 2021 17:40:25 -0500 Subject: [PATCH] Use string_view instead of copy whole string. --- src/core/kernel/support/EmuFile.cpp | 8 ++++---- src/core/kernel/support/EmuFile.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/kernel/support/EmuFile.cpp b/src/core/kernel/support/EmuFile.cpp index 79b34b441..84f297f94 100644 --- a/src/core/kernel/support/EmuFile.cpp +++ b/src/core/kernel/support/EmuFile.cpp @@ -609,18 +609,18 @@ int CxbxDeviceIndexByHostPath(const char * HostDevicePath) return -1; } -XboxDevice *CxbxDeviceByDevicePath(const std::string XboxDevicePath) +XboxDevice *CxbxDeviceByDevicePath(const std::string_view XboxDevicePath) { - int DeviceIndex = CxbxDeviceIndexByDevicePath(XboxDevicePath.c_str()); + int DeviceIndex = CxbxDeviceIndexByDevicePath(XboxDevicePath.data()); if (DeviceIndex >= 0) return &Devices[DeviceIndex]; return nullptr; } -XboxDevice *CxbxDeviceByHostPath(const std::string HostDevicePath) +XboxDevice *CxbxDeviceByHostPath(const std::string_view HostDevicePath) { - int DeviceIndex = CxbxDeviceIndexByHostPath(HostDevicePath.c_str()); + int DeviceIndex = CxbxDeviceIndexByHostPath(HostDevicePath.data()); if (DeviceIndex >= 0) return &Devices[DeviceIndex]; diff --git a/src/core/kernel/support/EmuFile.h b/src/core/kernel/support/EmuFile.h index cfd99747d..c1249ac91 100644 --- a/src/core/kernel/support/EmuFile.h +++ b/src/core/kernel/support/EmuFile.h @@ -220,8 +220,8 @@ CHAR* NtStatusToString(IN NTSTATUS Status); int CxbxRegisterDeviceHostPath(std::string_view XboxFullPath, std::string HostDevicePath, bool IsFile = false); int CxbxDeviceIndexByDevicePath(const char *XboxDevicePath); -XboxDevice *CxbxDeviceByDevicePath(const std::string XboxDevicePath); -XboxDevice* CxbxDeviceByHostPath(const std::string HostPath); +XboxDevice *CxbxDeviceByDevicePath(const std::string_view XboxDevicePath); +XboxDevice* CxbxDeviceByHostPath(const std::string_view HostPath); std::string CxbxConvertXboxToHostPath(const std::string_view XboxDevicePath); char SymbolicLinkToDriveLetter(std::string aSymbolicLinkName);