From: Stephen Toub Date: Sat, 13 May 2023 06:35:24 +0000 (-0400) Subject: Remove char[] allocation from TarHeader (#86201) X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~2248 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff65075a1f79f4a76146321f725cc950d66c3d04;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Remove char[] allocation from TarHeader (#86201) --- diff --git a/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarHeader.cs b/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarHeader.cs index e511296..f72a69d 100644 --- a/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarHeader.cs +++ b/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarHeader.cs @@ -120,7 +120,7 @@ namespace System.Formats.Tar { KeyValuePair kvp = enumerator.Current; - int index = kvp.Key.IndexOfAny(new char[] { '=', '\n' }); + int index = kvp.Key.AsSpan().IndexOfAny('=', '\n'); if (index >= 0) { throw new ArgumentException(SR.Format(SR.TarExtAttrDisallowedKeyChar, kvp.Key, kvp.Key[index] == '\n' ? "\\n" : kvp.Key[index]));