As suggested, extract strlen calls from sizes into variables so it isn't called twice

This commit is contained in:
Glenn Smith 2018-03-08 20:59:40 -05:00
parent eab086e184
commit 47d5b6ead7
33 changed files with 171 additions and 114 deletions

View file

@ -288,8 +288,9 @@ bool EventManager::subscribe(SimObject *callbackObj, const char* event, const ch
}
else
{
cb = new char[dStrlen(callback) + 1];
dStrcpy(cb, callback, dStrlen(callback) + 1);
dsize_t cbLen = dStrlen(callback) + 1;
cb = new char[cbLen];
dStrcpy(cb, callback, cbLen);
}
// Create the subscriber object.