From: <ral...@us...> - 2014-03-07 18:19:26
|
Revision: 9321 http://sourceforge.net/p/planeshift/code/9321 Author: ralphcampbell Date: 2014-03-07 18:19:21 +0000 (Fri, 07 Mar 2014) Log Message: ----------- Preallocate enough space in array 'profs' in psNetMsgProfiles::AddEnoughRecords(). Modified Paths: -------------- trunk/src/common/net/netprofile.cpp Modified: trunk/src/common/net/netprofile.cpp =================================================================== --- trunk/src/common/net/netprofile.cpp 2014-03-07 17:35:14 UTC (rev 9320) +++ trunk/src/common/net/netprofile.cpp 2014-03-07 18:19:21 UTC (rev 9321) @@ -28,12 +28,14 @@ if ((size_t)neededIndex < i) return; arr.SetSize(neededIndex + 1); - for (; i < arr.GetSize(); i++) + size_t d = profs.GetSize(); + profs.SetSize(d + arr.GetSize() - i); + for (; i < arr.GetSize(); i++, d++) { csStringFast<100> fullDesc = GetMsgTypeName((int)arr.GetSize()) + "-" + desc; psOperProfile * newProf = new psOperProfile(fullDesc); arr[i] = newProf; - profs.Push(newProf); + profs[d] = newProf; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |