mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
enhance: only alloc temp buffer once time (#597)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
339bceef3d
commit
d3d71af0e8
1 changed files with 7 additions and 9 deletions
|
@ -10,21 +10,20 @@
|
|||
int marker1 = 0;
|
||||
int marker2 = 0;
|
||||
|
||||
char[] tmp1 = new char[len1];
|
||||
char[] tmp2 = new char[len2];
|
||||
|
||||
while (marker1 < len1 && marker2 < len2)
|
||||
{
|
||||
char c1 = s1[marker1];
|
||||
char c2 = s2[marker2];
|
||||
|
||||
char[] space1 = new char[len1];
|
||||
char[] space2 = new char[len2];
|
||||
|
||||
int loc1 = 0;
|
||||
int loc2 = 0;
|
||||
|
||||
bool isDigit1 = char.IsDigit(c1);
|
||||
do
|
||||
{
|
||||
space1[loc1] = c1;
|
||||
tmp1[loc1] = c1;
|
||||
loc1++;
|
||||
marker1++;
|
||||
|
||||
|
@ -37,7 +36,7 @@
|
|||
bool isDigit2 = char.IsDigit(c2);
|
||||
do
|
||||
{
|
||||
space2[loc2] = c2;
|
||||
tmp2[loc2] = c2;
|
||||
loc2++;
|
||||
marker2++;
|
||||
|
||||
|
@ -47,9 +46,8 @@
|
|||
break;
|
||||
} while (char.IsDigit(c2) == isDigit2);
|
||||
|
||||
string sub1 = new string(space1, 0, loc1);
|
||||
string sub2 = new string(space2, 0, loc2);
|
||||
|
||||
string sub1 = new string(tmp1, 0, loc1);
|
||||
string sub2 = new string(tmp2, 0, loc2);
|
||||
int result;
|
||||
if (isDigit1 && isDigit2)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue