diff --git a/src/HttpHeaderProcessor.cc b/src/HttpHeaderProcessor.cc index 9b40b2e7..53f061e6 100644 --- a/src/HttpHeaderProcessor.cc +++ b/src/HttpHeaderProcessor.cc @@ -79,7 +79,7 @@ HttpHeaderProcessor::HttpHeaderProcessor(ParserMode mode) state_(mode == CLIENT_PARSER ? PREV_RES_VERSION : PREV_METHOD), lastBytesProcessed_(0), lastFieldHdKey_(HttpHeader::MAX_INTERESTING_HEADER), - result_(new HttpHeader()) + result_(make_unique()) { } @@ -481,7 +481,7 @@ void HttpHeaderProcessor::clear() buf_.clear(); lastFieldName_.clear(); lastFieldHdKey_ = HttpHeader::MAX_INTERESTING_HEADER; - result_.reset(new HttpHeader()); + result_ = make_unique(); headers_.clear(); } diff --git a/src/bignum.h b/src/bignum.h index 33e631ad..e59ab6bb 100644 --- a/src/bignum.h +++ b/src/bignum.h @@ -31,17 +31,17 @@ private: std::unique_ptr buf_; public: - inline ulong() : buf_(new char_t[dim]()) {} - inline ulong(size_t t) : buf_(new char_t[dim]()) + inline ulong() : buf_(make_unique(dim)) {} + inline ulong(size_t t) : buf_(make_unique(dim)) { memcpy(buf_.get(), (char_t*)&t, sizeof(t)); } - inline ulong(const ulong& rhs) : buf_(new char_t[dim]()) + inline ulong(const ulong& rhs) : buf_(make_unique(dim)) { memcpy(buf_.get(), rhs.buf_.get(), dim); } explicit inline ulong(const char_t* data, size_t size) - : buf_(new char_t[dim]()) + : buf_(make_unique(dim)) { if (size > dim) { throw std::bad_alloc(); diff --git a/src/crypto_hash.cc b/src/crypto_hash.cc index f6fb6d99..5ea03341 100644 --- a/src/crypto_hash.cc +++ b/src/crypto_hash.cc @@ -1055,22 +1055,22 @@ std::unique_ptr crypto::hash::create(Algorithms algo) { switch (algo) { case algoMD5: - return std::unique_ptr(new MD5()); + return make_unique(); case algoSHA1: - return std::unique_ptr(new SHA1()); + return make_unique(); case algoSHA224: - return std::unique_ptr(new SHA224()); + return make_unique(); case algoSHA256: - return std::unique_ptr(new SHA256()); + return make_unique(); case algoSHA384: - return std::unique_ptr(new SHA384()); + return make_unique(); case algoSHA512: - return std::unique_ptr(new SHA512()); + return make_unique(); default: throw std::domain_error("Invalid hash algorithm");