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

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRolf Bjarne Kvinge <rolf@xamarin.com>2016-01-27 19:39:45 +0300
committerRolf Bjarne Kvinge <rolf@xamarin.com>2016-01-28 16:49:11 +0300
commitf4f993f4bf4b9c413f61e6b7704dbbf6964d74bd (patch)
tree0152a43a10e2f7d0230dfc4332dd2733e1cfdc37
parent0f83276b643aef479aab95b8bd755572dc64e15a (diff)
[mono-api-info] Improve CleanupTypeName to not create 3 strings every time somethings needs to change.
-rw-r--r--mcs/tools/corcompare/mono-api-info.cs23
1 files changed, 22 insertions, 1 deletions
diff --git a/mcs/tools/corcompare/mono-api-info.cs b/mcs/tools/corcompare/mono-api-info.cs
index e2bbb36751a..173c39f6604 100644
--- a/mcs/tools/corcompare/mono-api-info.cs
+++ b/mcs/tools/corcompare/mono-api-info.cs
@@ -119,6 +119,7 @@ namespace CorCompare
}
public class Utils {
+ static char[] CharsToCleanup = new char[] { '<', '>', '/' };
public static string CleanupTypeName (TypeReference type)
{
@@ -127,7 +128,27 @@ namespace CorCompare
public static string CleanupTypeName (string t)
{
- return t.Replace ('<', '[').Replace ('>', ']').Replace ('/', '+');
+ if (t.IndexOfAny (CharsToCleanup) == -1)
+ return t;
+ var sb = new StringBuilder (t.Length);
+ for (int i = 0; i < t.Length; i++) {
+ var ch = t [i];
+ switch (ch) {
+ case '<':
+ sb.Append ('[');
+ break;
+ case '>':
+ sb.Append (']');
+ break;
+ case '/':
+ sb.Append ('+');
+ break;
+ default:
+ sb.Append (ch);
+ break;
+ }
+ }
+ return sb.ToString ();
}
}