diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-10-02 19:59:41 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-10-03 16:52:36 +0000 |
commit | 6a0ea2d5fce1967927cf1f4f319fb0209ac2eb1e (patch) | |
tree | cdf844359ac298e85d5ffc4e15f467964a8c7593 /config | |
parent | 74d9d289d9b9ffd5f9f427a1fb7abf176bae4abe (diff) |
Checkpoint 1
Diffstat (limited to 'config')
-rw-r--r-- | config/src/vespa/config/frt/protocol.cpp | 11 | ||||
-rw-r--r-- | config/src/vespa/config/frt/protocol.h | 6 |
2 files changed, 9 insertions, 8 deletions
diff --git a/config/src/vespa/config/frt/protocol.cpp b/config/src/vespa/config/frt/protocol.cpp index be02bc59862..5c7af53d2af 100644 --- a/config/src/vespa/config/frt/protocol.cpp +++ b/config/src/vespa/config/frt/protocol.cpp @@ -6,6 +6,7 @@ LOG_SETUP(".config.frt.protocol"); #include <vespa/vespalib/util/stringfmt.h> using namespace vespalib; +using vespalib::alloc::Alloc; using namespace vespalib::slime; namespace config { @@ -58,15 +59,15 @@ const Memory RESPONSE_COMPRESSION_INFO_UNCOMPRESSED_SIZE = "uncompressedSize"; DecompressedData decompress_lz4(const char * input, uint32_t inputLen, int uncompressedLength) { - DefaultAlloc::UP memory(new DefaultAlloc(uncompressedLength)); - int sz = LZ4_decompress_safe(input, static_cast<char *>(memory->get()), inputLen, uncompressedLength); + Alloc memory( DefaultAlloc::create(uncompressedLength)); + int sz = LZ4_decompress_safe(input, static_cast<char *>(memory.get()), inputLen, uncompressedLength); if (sz >= 0 && sz != uncompressedLength) { if (LOG_WOULD_LOG(debug)) { LOG(debug, "Returned compressed size (%d) is not the same as uncompressed size(%d)", sz, uncompressedLength); } - DefaultAlloc * copy = new DefaultAlloc(sz); - memcpy(copy->get(), memory->get(), sz); - memory.reset(copy); + Alloc copy = memory.create(sz); + memcpy(copy.get(), memory.get(), sz); + memory = std::move(copy); } assert(sz >= 0); return DecompressedData(std::move(memory), static_cast<uint32_t>(sz)); diff --git a/config/src/vespa/config/frt/protocol.h b/config/src/vespa/config/frt/protocol.h index 79d916bf3e7..6d1c2b8226c 100644 --- a/config/src/vespa/config/frt/protocol.h +++ b/config/src/vespa/config/frt/protocol.h @@ -59,9 +59,9 @@ extern const vespalib::slime::Memory RESPONSE_COMPRESSION_INFO_TYPE; extern const vespalib::slime::Memory RESPONSE_COMPRESSION_INFO_UNCOMPRESSED_SIZE; struct DecompressedData { - DecompressedData(vespalib::DefaultAlloc::UP mem, uint32_t sz) + DecompressedData(vespalib::alloc::Alloc mem, uint32_t sz) : memory(std::move(mem)), - memRef(static_cast<const char *>(memory->get()), sz), + memRef(static_cast<const char *>(memory.get()), sz), size(sz) { } DecompressedData(const vespalib::slime::Memory & mem, uint32_t sz) @@ -70,7 +70,7 @@ struct DecompressedData { size(sz) {} - vespalib::DefaultAlloc::UP memory; + vespalib::alloc::Alloc memory; vespalib::slime::Memory memRef; uint32_t size; }; |