Clean up Uri.UnescapeDataString (dotnet/corefx#42225)
commit6ae336034290d14825ab8acb4b0385b9d69fa48a
authorStephen Toub <stoub@microsoft.com>
Thu, 31 Oct 2019 00:00:25 +0000 (30 20:00 -0400)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Thu, 31 Oct 2019 10:09:58 +0000 (31 11:09 +0100)
treeea985d58d79695199c87bdb480cf522b5379340b
parenta94dda5b5a88bcae61efc4c17274dc38cc5bad0a
Clean up Uri.UnescapeDataString (dotnet/corefx#42225)

- Use string.IndexOf rather than an open-coded, unsafe loop.
- Avoid an unnecessary SequenceEquals at the end: we're only at this point if a `%` was found highlighting that something escaped was found.
- Use stack memory for smaller inputs if possible, to avoid unnecessary ArrayPool interaction
- Remove an unnecessary argument to a helper function.
- Fix ValueStringBuilder.Grow to only copy the contained data.

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
netcore/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs