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
|
|
@ -40,8 +40,9 @@ bool InitOpenGL()
|
|||
|
||||
// Get the video settings from the prefs:
|
||||
const char* resString = Con::getVariable( "$pref::Video::resolution" );
|
||||
char* tempBuf = new char[dStrlen( resString ) + 1];
|
||||
dStrcpy( tempBuf, resString, dStrlen(resString) + 1 );
|
||||
dsize_t tempBufLen = dStrlen(resString) + 1;
|
||||
char* tempBuf = new char[tempBufLen];
|
||||
dStrcpy( tempBuf, resString, tempBufLen );
|
||||
char* temp = dStrtok( tempBuf, " x\0" );
|
||||
U32 width = ( temp ? dAtoi( temp ) : 800 );
|
||||
temp = dStrtok( NULL, " x\0" );
|
||||
|
|
|
|||
|
|
@ -101,8 +101,9 @@ void UnixRedBookDevice::setDeviceInfo(S32 deviceId, const char *deviceName)
|
|||
{
|
||||
#if !defined(__FreeBSD__)
|
||||
mDeviceId = deviceId;
|
||||
mDeviceName = new char[dStrlen(deviceName) + 1];
|
||||
dStrcpy(mDeviceName, deviceName, dStrlen(deviceName) + 1);
|
||||
dsize_t deviceNameLen = dStrlen(deviceName) + 1;
|
||||
mDeviceName = new char[deviceNameLen];
|
||||
dStrcpy(mDeviceName, deviceName, deviceNameLen);
|
||||
#endif // !defined(__FreeBSD__)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue