Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrant <grant@jesanna.com>2018-09-12 13:19:37 +0300
committerJan Kotas <jkotas@microsoft.com>2018-09-12 16:50:36 +0300
commit98962048598d3743b67b2b4475c908241fef550b (patch)
treecba1a11470b0d6f0bf091a6d55894574a1a4c2d3
parent140f71b6164e698eed4e4f5776607bf1be97f438 (diff)
CallSites for MemoryExtensions.Contains (CoreCLR) (dotnet/coreclr#19874)
* Update additional callsites for MemoryExtensions.Contains * One more callsite * More callsites * CR fixes Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
-rw-r--r--src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/TraceLogging/Statics.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/Globalization/CalendarData.Unix.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/Globalization/CultureData.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/Guid.cs4
-rw-r--r--src/System.Private.CoreLib/shared/System/IO/Path.Unix.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/IO/Path.Windows.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/IO/PathHelper.Windows.cs4
-rw-r--r--src/System.Private.CoreLib/shared/System/SpanHelpers.T.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/String.Searching.cs5
9 files changed, 11 insertions, 14 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/TraceLogging/Statics.cs b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/TraceLogging/Statics.cs
index 0c2167213..3dc788350 100644
--- a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/TraceLogging/Statics.cs
+++ b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/TraceLogging/Statics.cs
@@ -174,7 +174,7 @@ namespace System.Diagnostics.Tracing
public static void CheckName(string name)
{
- if (name != null && 0 <= name.IndexOf('\0'))
+ if (name != null && name.Contains('\0'))
{
throw new ArgumentOutOfRangeException(nameof(name));
}
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/CalendarData.Unix.cs b/src/System.Private.CoreLib/shared/System/Globalization/CalendarData.Unix.cs
index 61e06914c..c94ac0ae5 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/CalendarData.Unix.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/CalendarData.Unix.cs
@@ -311,7 +311,7 @@ namespace System.Globalization
break;
default:
const string unsupportedDateFieldSymbols = "YuUrQqwWDFg";
- Debug.Assert(unsupportedDateFieldSymbols.IndexOf(input[index]) == -1,
+ Debug.Assert(!unsupportedDateFieldSymbols.Contains(input[index]),
string.Format(CultureInfo.InvariantCulture,
"Encountered an unexpected date field symbol '{0}' from ICU which has no known corresponding .NET equivalent.",
input[index]));
diff --git a/src/System.Private.CoreLib/shared/System/Globalization/CultureData.cs b/src/System.Private.CoreLib/shared/System/Globalization/CultureData.cs
index fda239c51..5eb9f44f8 100644
--- a/src/System.Private.CoreLib/shared/System/Globalization/CultureData.cs
+++ b/src/System.Private.CoreLib/shared/System/Globalization/CultureData.cs
@@ -2268,7 +2268,7 @@ namespace System.Globalization
for (int i = startIndex; i < format.Length; ++i)
{
// See if we have a time Part
- if (!inQuote && timeParts.IndexOf(format[i]) != -1)
+ if (!inQuote && timeParts.Contains(format[i]))
{
return i;
}
diff --git a/src/System.Private.CoreLib/shared/System/Guid.cs b/src/System.Private.CoreLib/shared/System/Guid.cs
index c57d3c4d9..6e6ec067a 100644
--- a/src/System.Private.CoreLib/shared/System/Guid.cs
+++ b/src/System.Private.CoreLib/shared/System/Guid.cs
@@ -449,7 +449,7 @@ namespace System
}
// Check for braces
- bool bracesExistInString = (guidString.IndexOf('{') >= 0);
+ bool bracesExistInString = guidString.Contains('{');
if (bracesExistInString)
{
@@ -471,7 +471,7 @@ namespace System
}
// Check for parenthesis
- bool parenthesisExistInString = (guidString.IndexOf('(') >= 0);
+ bool parenthesisExistInString = guidString.Contains('(');
if (parenthesisExistInString)
{
diff --git a/src/System.Private.CoreLib/shared/System/IO/Path.Unix.cs b/src/System.Private.CoreLib/shared/System/IO/Path.Unix.cs
index f364b84df..ecf71e612 100644
--- a/src/System.Private.CoreLib/shared/System/IO/Path.Unix.cs
+++ b/src/System.Private.CoreLib/shared/System/IO/Path.Unix.cs
@@ -23,7 +23,7 @@ namespace System.IO
if (path.Length == 0)
throw new ArgumentException(SR.Arg_PathEmpty, nameof(path));
- if (path.IndexOf('\0') != -1)
+ if (path.Contains('\0'))
throw new ArgumentException(SR.Argument_InvalidPathChars, nameof(path));
// Expand with current directory if necessary
diff --git a/src/System.Private.CoreLib/shared/System/IO/Path.Windows.cs b/src/System.Private.CoreLib/shared/System/IO/Path.Windows.cs
index 1c27e0cf1..ddfd7966b 100644
--- a/src/System.Private.CoreLib/shared/System/IO/Path.Windows.cs
+++ b/src/System.Private.CoreLib/shared/System/IO/Path.Windows.cs
@@ -47,7 +47,7 @@ namespace System.IO
// Embedded null characters are the only invalid character case we trully care about.
// This is because the nulls will signal the end of the string to Win32 and therefore have
// unpredictable results.
- if (path.IndexOf('\0') != -1)
+ if (path.Contains('\0'))
throw new ArgumentException(SR.Argument_InvalidPathChars, nameof(path));
if (PathInternal.IsExtended(path.AsSpan()))
diff --git a/src/System.Private.CoreLib/shared/System/IO/PathHelper.Windows.cs b/src/System.Private.CoreLib/shared/System/IO/PathHelper.Windows.cs
index bada2f5cd..f9a649590 100644
--- a/src/System.Private.CoreLib/shared/System/IO/PathHelper.Windows.cs
+++ b/src/System.Private.CoreLib/shared/System/IO/PathHelper.Windows.cs
@@ -33,7 +33,7 @@ namespace System.IO
// If we have the exact same string we were passed in, don't allocate another string.
// TryExpandShortName does this input identity check.
- string result = builder.AsSpan().IndexOf('~') >= 0
+ string result = builder.AsSpan().Contains('~')
? TryExpandShortFileName(ref builder, originalPath: path)
: builder.AsSpan().Equals(path.AsSpan(), StringComparison.Ordinal) ? path : builder.ToString();
@@ -56,7 +56,7 @@ namespace System.IO
// Get the full path
GetFullPathName(path.AsSpan(terminate: true), ref builder);
- string result = builder.AsSpan().IndexOf('~') >= 0
+ string result = builder.AsSpan().Contains('~')
? TryExpandShortFileName(ref builder, originalPath: null)
: builder.ToString();
diff --git a/src/System.Private.CoreLib/shared/System/SpanHelpers.T.cs b/src/System.Private.CoreLib/shared/System/SpanHelpers.T.cs
index 20fdc616d..d6f45d226 100644
--- a/src/System.Private.CoreLib/shared/System/SpanHelpers.T.cs
+++ b/src/System.Private.CoreLib/shared/System/SpanHelpers.T.cs
@@ -51,7 +51,7 @@ namespace System
}
// Adapted from IndexOf(...)
- public static unsafe bool Contains<T>(ref T searchSpace, T value, int length)
+ public static bool Contains<T>(ref T searchSpace, T value, int length)
where T : IEquatable<T>
{
Debug.Assert(length >= 0);
diff --git a/src/System.Private.CoreLib/shared/System/String.Searching.cs b/src/System.Private.CoreLib/shared/System/String.Searching.cs
index 857d64eec..7660c5225 100644
--- a/src/System.Private.CoreLib/shared/System/String.Searching.cs
+++ b/src/System.Private.CoreLib/shared/System/String.Searching.cs
@@ -22,10 +22,7 @@ namespace System
return (IndexOf(value, comparisonType) >= 0);
}
- public bool Contains(char value)
- {
- return IndexOf(value) != -1;
- }
+ public bool Contains(char value) => SpanHelpers.Contains(ref _firstChar, value, Length);
public bool Contains(char value, StringComparison comparisonType)
{