misc: chore: Merge duplicated 'if' branches

This commit is contained in:
KeatonTheBot 2025-08-29 17:39:03 -05:00
parent dfb6164ba5
commit d773bd60f4
22 changed files with 76 additions and 306 deletions

View file

@ -94,12 +94,8 @@ namespace Ryujinx.Memory
throw new SystemException(Marshal.GetLastPInvokeErrorMessage());
}
if (madvise(address, size, MADV_REMOVE) != 0)
{
throw new SystemException(Marshal.GetLastPInvokeErrorMessage());
}
if (mprotect(address, size, MmapProts.PROT_NONE) != 0)
if (madvise(address, size, MADV_REMOVE) != 0
|| mprotect(address, size, MmapProts.PROT_NONE) != 0)
{
throw new SystemException(Marshal.GetLastPInvokeErrorMessage());
}
@ -186,12 +182,7 @@ namespace Ryujinx.Memory
fixed (byte* pFileName = fileName)
{
fd = mkstemp((IntPtr)pFileName);
if (fd == -1)
{
throw new SystemException(Marshal.GetLastPInvokeErrorMessage());
}
if (unlink((IntPtr)pFileName) != 0)
if (fd == -1 || unlink((IntPtr)pFileName) != 0)
{
throw new SystemException(Marshal.GetLastPInvokeErrorMessage());
}