mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Prefer std::copy_n over std::copy where appropriate.
std::copy_n saves us from having to do the addition manually.
This commit is contained in:
@@ -760,7 +760,7 @@ std::vector<uint8_t> readToEOF(int fd) {
|
||||
ssize_t readSize = 0;
|
||||
while ((readSize = read(fd, readBuffer, BUFFER_SIZE)) > 0) {
|
||||
retData.reserve(retData.size() + readSize);
|
||||
std::copy(readBuffer, readBuffer + readSize, std::back_inserter(retData));
|
||||
std::copy_n(readBuffer, readSize, std::back_inserter(retData));
|
||||
}
|
||||
return retData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user