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 ed10ce2511
commit 6b024b21bf
33 changed files with 171 additions and 114 deletions

View file

@ -177,8 +177,9 @@ bool CentralDir::write(Stream *stream)
void CentralDir::setFileComment(const char *comment)
{
SAFE_DELETE_ARRAY(mFileComment);
mFileComment = new char [dStrlen(comment)+1];
dStrcpy(mFileComment, comment, dStrlen(comment)+1);
dsize_t commentLen = dStrlen(comment) + 1;
mFileComment = new char [commentLen];
dStrcpy(mFileComment, comment, commentLen);
}
//-----------------------------------------------------------------------------