diff options
author | TSRBerry <20988865+TSRBerry@users.noreply.github.com> | 2023-06-24 02:46:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-24 02:46:04 +0200 |
commit | 7d160e98fde05e0b9b542dc04ea72dc34994bc5b (patch) | |
tree | 958d5f376a5a2421a7a58b21080eb454f9c744c1 /src/Ryujinx.Memory/MemoryManagementUnix.cs | |
parent | bf96bc84a82f2c4ab771b2ab0c610f86d00b1adf (diff) |
MemoryManagement: Change return types for Commit/Decommit to void (#5325)1.1.905
* Replace return type with void for Commit/Decommit
* Small cleanup
Diffstat (limited to 'src/Ryujinx.Memory/MemoryManagementUnix.cs')
-rw-r--r-- | src/Ryujinx.Memory/MemoryManagementUnix.cs | 16 |
1 files changed, 5 insertions, 11 deletions
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<IntPtr, ulong> _allocations = new ConcurrentDictionary<IntPtr, ulong>(); + private static readonly ConcurrentDictionary<IntPtr, ulong> _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) { |