Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove redundant array allocation #1655

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/EntityFramework.Storage/Extensions/StringsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static string ToSpaceSeparatedString(this IEnumerable<string> list)
public static IEnumerable<string> FromSpaceSeparatedString(this string input)
{
input = input.Trim();
return input.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
return input.Split(' ' , StringSplitOptions.RemoveEmptyEntries).ToList();
}

public static List<string> ParseScopesString(this string scopes)
Expand All @@ -38,7 +38,7 @@ public static List<string> ParseScopesString(this string scopes)
}

scopes = scopes.Trim();
var parsedScopes = scopes.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Distinct().ToList();
var parsedScopes = scopes.Split(' ', StringSplitOptions.RemoveEmptyEntries).Distinct().ToList();

if (parsedScopes.Any())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static ICollection<string> Convert(string sourceMember)
if (!String.IsNullOrWhiteSpace(sourceMember))
{
sourceMember = sourceMember.Trim();
foreach (var item in sourceMember.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Distinct())
foreach (var item in sourceMember.Split(',', StringSplitOptions.RemoveEmptyEntries).Distinct())
{
list.Add(item);
}
Expand Down
2 changes: 1 addition & 1 deletion src/IdentityServer/Extensions/ServerUrlExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static class ServerUrlExtensions
/// </summary>
public static string GetUnicodeOrigin(this IServerUrls urls)
{
var split = urls.Origin.Split(new[] { "://" }, StringSplitOptions.RemoveEmptyEntries);
var split = urls.Origin.Split("://", StringSplitOptions.RemoveEmptyEntries);
var scheme = split.First();
var host = HostString.FromUriComponent(split.Last()).Value;

Expand Down
4 changes: 2 additions & 2 deletions src/IdentityServer/Extensions/StringsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static string ToSpaceSeparatedString(this IEnumerable<string> list)
public static IEnumerable<string> FromSpaceSeparatedString(this string input)
{
input = input.Trim();
return input.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
return input.Split(' ', StringSplitOptions.RemoveEmptyEntries).ToList();
}

public static List<string> ParseScopesString(this string scopes)
Expand All @@ -41,7 +41,7 @@ public static List<string> ParseScopesString(this string scopes)
}

scopes = scopes.Trim();
var parsedScopes = scopes.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Distinct().ToList();
var parsedScopes = scopes.Split(' ', StringSplitOptions.RemoveEmptyEntries).Distinct().ToList();

if (parsedScopes.Any())
{
Expand Down
2 changes: 1 addition & 1 deletion src/IdentityServer/Services/Default/DefaultServerUrls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public string Origin
}
set
{
var split = value.Split(new[] { "://" }, StringSplitOptions.RemoveEmptyEntries);
var split = value.Split("://", StringSplitOptions.RemoveEmptyEntries);

var request = _httpContextAccessor.HttpContext.Request;
request.Scheme = split.First();
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/Models/OidcProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public IEnumerable<string> Scopes
{
get
{
var scopes = Scope?.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList() ?? new List<string>();
var scopes = Scope?.Split(' ', StringSplitOptions.RemoveEmptyEntries).ToList() ?? new List<string>();
return scopes;
}
}
Expand Down
Loading