mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-24 13:55:34 +00:00
As suggested, extract strlen calls from sizes into variables so it isn't called twice
This commit is contained in:
parent
ed10ce2511
commit
6b024b21bf
33 changed files with 171 additions and 114 deletions
|
|
@ -446,8 +446,9 @@ bool afxMagicMissileData::onAdd()
|
|||
Vector<char*> dataBlocks(__FILE__, __LINE__);
|
||||
|
||||
// make a copy of points_string
|
||||
char* tokCopy = new char[dStrlen(wiggle_axis_string) + 1];
|
||||
dStrcpy(tokCopy, wiggle_axis_string, dStrlen(wiggle_axis_string) + 1);
|
||||
dsize_t tokCopyLen = dStrlen(wiggle_axis_string) + 1;
|
||||
char* tokCopy = new char[tokCopyLen];
|
||||
dStrcpy(tokCopy, wiggle_axis_string, tokCopyLen);
|
||||
|
||||
// extract tokens one by one, adding them to dataBlocks
|
||||
char* currTok = dStrtok(tokCopy, " \t");
|
||||
|
|
|
|||
|
|
@ -141,8 +141,9 @@ bool afxParticleEmitterData::onAdd()
|
|||
if (tpaths_string != ST_NULLSTRING)
|
||||
{
|
||||
Vector<char*> dataBlocks(__FILE__, __LINE__);
|
||||
char* tokCopy = new char[dStrlen(tpaths_string) + 1];
|
||||
dStrcpy(tokCopy, tpaths_string, dStrlen(tpaths_string) + 1);
|
||||
dsize_t tokCopyLen = dStrlen(tpaths_string) + 1;
|
||||
char* tokCopy = new char[tokCopyLen];
|
||||
dStrcpy(tokCopy, tpaths_string, tokCopyLen);
|
||||
|
||||
char* currTok = dStrtok(tokCopy, " \t");
|
||||
while (currTok != NULL)
|
||||
|
|
@ -467,8 +468,9 @@ bool afxParticleEmitterPathData::onAdd()
|
|||
if (epaths_string != ST_NULLSTRING)
|
||||
{
|
||||
Vector<char*> dataBlocks(__FILE__, __LINE__);
|
||||
char* tokCopy = new char[dStrlen(epaths_string) + 1];
|
||||
dStrcpy(tokCopy, epaths_string, dStrlen(epaths_string) + 1);
|
||||
dsize_t tokCopyLen = dStrlen(epaths_string) + 1;
|
||||
char* tokCopy = new char[tokCopyLen];
|
||||
dStrcpy(tokCopy, epaths_string, tokCopyLen);
|
||||
|
||||
char* currTok = dStrtok(tokCopy, " \t");
|
||||
while (currTok != NULL)
|
||||
|
|
@ -552,8 +554,9 @@ void afxParticleEmitterPathData::onPerformSubstitutions()
|
|||
if (epaths_string != ST_NULLSTRING)
|
||||
{
|
||||
Vector<char*> dataBlocks(__FILE__, __LINE__);
|
||||
char* tokCopy = new char[dStrlen(epaths_string) + 1];
|
||||
dStrcpy(tokCopy, epaths_string, dStrlen(epaths_string) + 1);
|
||||
dsize_t tokCopyLen = dStrlen(epaths_string) + 1;
|
||||
char* tokCopy = new char[tokCopyLen];
|
||||
dStrcpy(tokCopy, epaths_string, tokCopyLen);
|
||||
|
||||
char* currTok = dStrtok(tokCopy, " \t");
|
||||
while (currTok != NULL)
|
||||
|
|
|
|||
|
|
@ -194,8 +194,9 @@ bool afxXM_PathConformData::onAdd()
|
|||
if (paths_string != ST_NULLSTRING)
|
||||
{
|
||||
Vector<char*> dataBlocks(__FILE__, __LINE__);
|
||||
char* tokCopy = new char[dStrlen(paths_string) + 1];
|
||||
dStrcpy(tokCopy, paths_string, dStrlen(paths_string) + 1);
|
||||
dsize_t tokCopyLen = dStrlen(paths_string) + 1;
|
||||
char* tokCopy = new char[tokCopyLen];
|
||||
dStrcpy(tokCopy, paths_string, tokCopyLen);
|
||||
|
||||
char* currTok = dStrtok(tokCopy, " \t");
|
||||
while (currTok != NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue