1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 00:11:17 +02:00

AutoDeleteArray -> std::unique_ptr

Also, switch to C++14 for std::make_unique.
This commit is contained in:
Eelco Dolstra 2017-01-16 22:24:29 +01:00
parent 40dfac968a
commit 2b9d0a99cb
5 changed files with 10 additions and 24 deletions

View file

@ -272,11 +272,10 @@ string readFile(int fd)
if (fstat(fd, &st) == -1)
throw SysError("statting file");
unsigned char * buf = new unsigned char[st.st_size];
AutoDeleteArray<unsigned char> d(buf);
readFull(fd, buf, st.st_size);
auto buf = std::make_unique<unsigned char[]>(st.st_size);
readFull(fd, buf.get(), st.st_size);
return string((char *) buf, st.st_size);
return string((char *) buf.get(), st.st_size);
}