projects
/
mono.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0f83276
)
[mono-api-info] Improve CleanupTypeName to not create 3 strings every time somethings...
author
Rolf Bjarne Kvinge
<rolf@xamarin.com>
Wed, 27 Jan 2016 16:39:45 +0000
(17:39 +0100)
committer
Rolf Bjarne Kvinge
<rolf@xamarin.com>
Thu, 28 Jan 2016 13:49:11 +0000
(14:49 +0100)
mcs/tools/corcompare/mono-api-info.cs
patch
|
blob
|
history
diff --git
a/mcs/tools/corcompare/mono-api-info.cs
b/mcs/tools/corcompare/mono-api-info.cs
index e2bbb36751afd6303549938e30d4f6f541d27fd4..173c39f66049505806e77363040c52de77c8df78 100644
(file)
--- 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 {
}
public class Utils {
+ static char[] CharsToCleanup = new char[] { '<', '>', '/' };
public static string CleanupTypeName (TypeReference type)
{
public static string CleanupTypeName (TypeReference type)
{
@@
-127,7
+128,27
@@
namespace CorCompare
public static string CleanupTypeName (string t)
{
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 ();
}
}
}
}