mirror of
https://github.com/NixOS/nix
synced 2025-06-27 08:31:16 +02:00
AutoDeleteArray -> std::unique_ptr
Also, switch to C++14 for std::make_unique.
This commit is contained in:
parent
40dfac968a
commit
2b9d0a99cb
5 changed files with 10 additions and 24 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <cstring>
|
||||
#include <cerrno>
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace nix {
|
||||
|
@ -236,11 +237,10 @@ size_t readString(unsigned char * buf, size_t max, Source & source)
|
|||
string readString(Source & source)
|
||||
{
|
||||
size_t len = readInt(source);
|
||||
unsigned char * buf = new unsigned char[len];
|
||||
AutoDeleteArray<unsigned char> d(buf);
|
||||
source(buf, len);
|
||||
auto buf = std::make_unique<unsigned char[]>(len);
|
||||
source(buf.get(), len);
|
||||
readPadding(len, source);
|
||||
return string((char *) buf, len);
|
||||
return string((char *) buf.get(), len);
|
||||
}
|
||||
|
||||
Source & operator >> (Source & in, string & s)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue