Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit f3fa757

Browse files
committed
Merge pull request #2319 from justinvp/fs_enumerate
Avoid unnecessary allocations in Win32 file system enumeration
2 parents 012f128 + b5a268d commit f3fa757

File tree

4 files changed

+249
-268
lines changed

4 files changed

+249
-268
lines changed

src/System.IO.FileSystem/src/System.IO.FileSystem.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
<Compile Include="System\IO\IFileSystemObject.cs" />
4444
<Compile Include="System\IO\Iterator.cs" />
4545
<Compile Include="System\IO\PathHelpers.cs" />
46+
<Compile Include="System\IO\PathPair.cs" />
4647
<Compile Include="System\IO\ReadLinesIterator.cs" />
4748
<Compile Include="System\IO\SearchOption.cs" />
4849
<Compile Include="System\IO\SearchTarget.cs" />
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
namespace System.IO
5+
{
6+
internal struct PathPair
7+
{
8+
internal readonly string UserPath;
9+
internal readonly string FullPath;
10+
11+
internal PathPair(string userPath, string fullPath)
12+
{
13+
UserPath = userPath;
14+
FullPath = fullPath;
15+
}
16+
}
17+
}

src/System.IO.FileSystem/src/System/IO/UnixFileSystem.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -524,18 +524,6 @@ private IEnumerator<T> Enumerate(Interop.libc.SafeDirHandle dirHandle)
524524
}
525525
}
526526

527-
private struct PathPair
528-
{
529-
internal readonly string UserPath;
530-
internal readonly string FullPath;
531-
532-
internal PathPair(string userPath, string fullPath)
533-
{
534-
UserPath = userPath;
535-
FullPath = fullPath;
536-
}
537-
}
538-
539527
private static string NormalizeSearchPattern(string searchPattern)
540528
{
541529
if (searchPattern == "." || searchPattern == "*.*")

0 commit comments

Comments
 (0)