aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Horizon/Sm/Impl/ServiceManager.cs
diff options
context:
space:
mode:
authorACGNnsj <ootopoo@vip.qq.com>2023-03-28 20:59:43 +0800
committerGitHub <noreply@github.com>2023-03-28 14:59:43 +0200
commit460f96967de6f5cb729ed57baaa4dad2178c8cb6 (patch)
tree9cb4ef2daa0e712d3b449572ab018e9fdab74179 /Ryujinx.Horizon/Sm/Impl/ServiceManager.cs
parent7ca779a26d76a3ad1edd94ba6c1cfd7466d73314 (diff)
Slight Code Refactoring (#4373)1.1.687
* Simplify return statements by using ternary expressions * Remove a redundant type conversion * Reduce nesting by inverting "if" statements * Try to improve code readability by using LINQ and inverting "if" statements * Try to improve code readability by using LINQ, using ternary expressions, and inverting "if" statements * Add line breaks to long LINQ * Add line breaks to long LINQ
Diffstat (limited to 'Ryujinx.Horizon/Sm/Impl/ServiceManager.cs')
-rw-r--r--Ryujinx.Horizon/Sm/Impl/ServiceManager.cs15
1 files changed, 2 insertions, 13 deletions
diff --git a/Ryujinx.Horizon/Sm/Impl/ServiceManager.cs b/Ryujinx.Horizon/Sm/Impl/ServiceManager.cs
index 44a1ec46..d1f94267 100644
--- a/Ryujinx.Horizon/Sm/Impl/ServiceManager.cs
+++ b/Ryujinx.Horizon/Sm/Impl/ServiceManager.cs
@@ -37,12 +37,7 @@ namespace Ryujinx.Horizon.Sm.Impl
result = GetServiceImpl(out handle, ref _services[serviceIndex]);
- if (result == KernelResult.SessionCountExceeded)
- {
- return SmResult.OutOfSessions;
- }
-
- return result;
+ return result == KernelResult.SessionCountExceeded ? SmResult.OutOfSessions : result;
}
private Result GetServiceImpl(out int handle, ref ServiceInfo serviceInfo)
@@ -61,13 +56,7 @@ namespace Ryujinx.Horizon.Sm.Impl
}
// TODO: Validation with GetProcessInfo etc.
-
- if (HasServiceInfo(name))
- {
- return SmResult.AlreadyRegistered;
- }
-
- return RegisterServiceImpl(out handle, processId, name, maxSessions, isLight);
+ return HasServiceInfo(name) ? SmResult.AlreadyRegistered : RegisterServiceImpl(out handle, processId, name, maxSessions, isLight);
}
public Result RegisterServiceForSelf(out int handle, ServiceName name, int maxSessions)