Skip to content

Commit

Permalink
Avoid extra copy in PropStream::readString() (otland#4341)
Browse files Browse the repository at this point in the history
  • Loading branch information
ranisalt authored and EPuncker committed May 23, 2023
1 parent e1d861b commit 702fe39
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/fileloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,7 @@ class PropStream
return false;
}

char* str = new char[strLen + 1];
memcpy(str, p, strLen);
str[strLen] = 0;
ret.assign(str, strLen);
delete[] str;
ret.assign(p, strLen);
p += strLen;
return true;
}
Expand Down

0 comments on commit 702fe39

Please sign in to comment.