From 7d160e98fde05e0b9b542dc04ea72dc34994bc5b Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Sat, 24 Jun 2023 02:46:04 +0200 Subject: MemoryManagement: Change return types for Commit/Decommit to void (#5325) * Replace return type with void for Commit/Decommit * Small cleanup --- src/Ryujinx.Memory/MemoryManagementUnix.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/Ryujinx.Memory/MemoryManagementUnix.cs') diff --git a/src/Ryujinx.Memory/MemoryManagementUnix.cs b/src/Ryujinx.Memory/MemoryManagementUnix.cs index 30baf035..d665b229 100644 --- a/src/Ryujinx.Memory/MemoryManagementUnix.cs +++ b/src/Ryujinx.Memory/MemoryManagementUnix.cs @@ -2,8 +2,6 @@ using System.Collections.Concurrent; using System.Runtime.InteropServices; using System.Runtime.Versioning; -using System.Text; - using static Ryujinx.Memory.MemoryManagerUnixHelper; namespace Ryujinx.Memory @@ -12,7 +10,7 @@ namespace Ryujinx.Memory [SupportedOSPlatform("macos")] static class MemoryManagementUnix { - private static readonly ConcurrentDictionary _allocations = new ConcurrentDictionary(); + private static readonly ConcurrentDictionary _allocations = new(); public static IntPtr Allocate(ulong size, bool forJit) { @@ -68,7 +66,7 @@ namespace Ryujinx.Memory return ptr; } - public static bool Commit(IntPtr address, ulong size, bool forJit) + public static void Commit(IntPtr address, ulong size, bool forJit) { MmapProts prot = MmapProts.PROT_READ | MmapProts.PROT_WRITE; @@ -81,11 +79,9 @@ namespace Ryujinx.Memory { throw new SystemException(Marshal.GetLastPInvokeErrorMessage()); } - - return true; } - public static bool Decommit(IntPtr address, ulong size) + public static void Decommit(IntPtr address, ulong size) { // Must be writable for madvise to work properly. if (mprotect(address, size, MmapProts.PROT_READ | MmapProts.PROT_WRITE) != 0) @@ -102,8 +98,6 @@ namespace Ryujinx.Memory { throw new SystemException(Marshal.GetLastPInvokeErrorMessage()); } - - return true; } public static bool Reprotect(IntPtr address, ulong size, MemoryPermission permission) @@ -146,7 +140,7 @@ namespace Ryujinx.Memory if (OperatingSystem.IsMacOS()) { - byte[] memName = Encoding.ASCII.GetBytes("Ryujinx-XXXXXX"); + byte[] memName = "Ryujinx-XXXXXX"u8.ToArray(); fixed (byte* pMemName = memName) { @@ -164,7 +158,7 @@ namespace Ryujinx.Memory } else { - byte[] fileName = Encoding.ASCII.GetBytes("/dev/shm/Ryujinx-XXXXXX"); + byte[] fileName = "/dev/shm/Ryujinx-XXXXXX"u8.ToArray(); fixed (byte* pFileName = fileName) { -- cgit v1.2.3