misc: chore: Use collection expressions in HLE project

This commit is contained in:
Evan Husted
2025-01-26 15:43:02 -06:00
parent 3c2f283ec7
commit 70b767ef60
72 changed files with 312 additions and 299 deletions

View File

@@ -17,7 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
private BsdContext()
{
_fds = new List<IFileDescriptor>();
_fds = [];
}
public ISocket RetrieveSocket(int socketFd)
@@ -47,7 +47,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
public List<IFileDescriptor> RetrieveFileDescriptorsFromMask(ReadOnlySpan<byte> mask)
{
List<IFileDescriptor> fds = new();
List<IFileDescriptor> fds = [];
for (int i = 0; i < mask.Length; i++)
{

View File

@@ -16,11 +16,11 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
[Service("bsd:u", false)]
class IClient : IpcService
{
private static readonly List<IPollManager> _pollManagers = new()
{
private static readonly List<IPollManager> _pollManagers =
[
EventFileDescriptorPollManager.Instance,
ManagedSocketPollManager.Instance,
};
ManagedSocketPollManager.Instance
];
private BsdContext _context;
private readonly bool _isPrivileged;
@@ -265,7 +265,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
for (int i = 0; i < eventsByPollManager.Length; i++)
{
eventsByPollManager[i] = new List<PollEvent>();
eventsByPollManager[i] = [];
foreach (PollEvent evnt in events)
{
@@ -361,12 +361,12 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
events[i] = new PollEvent(pollEventData, fileDescriptor);
}
List<PollEvent> discoveredEvents = new();
List<PollEvent> discoveredEvents = [];
List<PollEvent>[] eventsByPollManager = new List<PollEvent>[_pollManagers.Count];
for (int i = 0; i < eventsByPollManager.Length; i++)
{
eventsByPollManager[i] = new List<PollEvent>();
eventsByPollManager[i] = [];
foreach (PollEvent evnt in events)
{

View File

@@ -28,7 +28,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
{
updatedCount = 0;
List<ManualResetEvent> waiters = new();
List<ManualResetEvent> waiters = [];
for (int i = 0; i < events.Count; i++)
{

View File

@@ -27,9 +27,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
public LinuxError Poll(List<PollEvent> events, int timeoutMilliseconds, out int updatedCount)
{
List<ISocketImpl> readEvents = new();
List<ISocketImpl> writeEvents = new();
List<ISocketImpl> errorEvents = new();
List<ISocketImpl> readEvents = [];
List<ISocketImpl> writeEvents = [];
List<ISocketImpl> errorEvents = [];
updatedCount = 0;
@@ -123,9 +123,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
public LinuxError Select(List<PollEvent> events, int timeout, out int updatedCount)
{
List<ISocketImpl> readEvents = new();
List<ISocketImpl> writeEvents = new();
List<ISocketImpl> errorEvents = new();
List<ISocketImpl> readEvents = [];
List<ISocketImpl> writeEvents = [];
List<ISocketImpl> errorEvents = [];
updatedCount = 0;