diff options
-rw-r--r-- | document/src/vespa/document/update/valueupdate.cpp | 10 | ||||
-rw-r--r-- | staging_vespalib/src/vespa/vespalib/objects/identifiable.cpp | 2 |
2 files changed, 5 insertions, 7 deletions
diff --git a/document/src/vespa/document/update/valueupdate.cpp b/document/src/vespa/document/update/valueupdate.cpp index 103d9341f0e..b43f9f7f095 100644 --- a/document/src/vespa/document/update/valueupdate.cpp +++ b/document/src/vespa/document/update/valueupdate.cpp @@ -13,20 +13,18 @@ IMPLEMENT_IDENTIFIABLE_ABSTRACT(ValueUpdate, Identifiable); std::unique_ptr<ValueUpdate> ValueUpdate::createInstance(const DocumentTypeRepo& repo, const DataType& type, ByteBuffer& buffer, int serializationVersion) { - ValueUpdate* update(NULL); int32_t classId = 0; buffer.getIntNetwork(classId); const Identifiable::RuntimeClass * rtc(Identifiable::classFromId(classId)); - if (rtc != NULL) { - update = static_cast<ValueUpdate*>(Identifiable::classFromId(classId)->create()); - /// \todo TODO (was warning): Updates are not versioned in serialization format. Will not work with altering it. + if (rtc != nullptr) { + std::unique_ptr<ValueUpdate> update(static_cast<ValueUpdate*>(rtc->create())); + /// \todo TODO (was warning): Updates are not versioned in serialization format. Will not work without altering it. update->deserialize(repo, type, buffer, serializationVersion); + return update; } else { throw std::runtime_error(vespalib::make_string("Could not find a class for classId %d(%x)", classId, classId)); } - - return std::unique_ptr<ValueUpdate>(update); } } diff --git a/staging_vespalib/src/vespa/vespalib/objects/identifiable.cpp b/staging_vespalib/src/vespa/vespalib/objects/identifiable.cpp index 52c9def3036..7e14fbc0014 100644 --- a/staging_vespalib/src/vespa/vespalib/objects/identifiable.cpp +++ b/staging_vespalib/src/vespa/vespalib/objects/identifiable.cpp @@ -48,7 +48,7 @@ Register::Register() : _listByName() { } -Register::~Register() { } +Register::~Register() = default; bool Register::erase(Identifiable::RuntimeClass * c) { |