dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Text StringBuilder.cs


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Text StringBuilder.cs,1.10,1.11
Date: Sun, 23 Feb 2003 00:17:34 -0500

Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Text
In directory subversions:/tmp/cvs-serv23688/runtime/System/Text

Modified Files:
        StringBuilder.cs 
Log Message:


Reallocate StringBuilder's by doubling their capacity each time they
overflow, instead of just adding 32 characters each time.


Index: StringBuilder.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Text/StringBuilder.cs,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** StringBuilder.cs    6 Dec 2002 04:58:32 -0000       1.10
--- StringBuilder.cs    23 Feb 2003 05:17:31 -0000      1.11
***************
*** 172,176 ****
  
                                // Determine the new length.
!                               newLength = buildLen + length;
                                if(newLength > maxCapacity)
                                {
--- 172,188 ----
  
                                // Determine the new length.
!                               if(buildString.capacity < 2048)
!                               {
!                                       int temp = buildLen + length;
!                                       newLength = buildString.capacity * 2;
!                                       if(temp > newLength)
!                                       {
!                                               newLength = temp;
!                                       }
!                               }
!                               else
!                               {
!                                       newLength = buildLen + length;
!                               }
                                if(newLength > maxCapacity)
                                {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]