From 438129e8b3bf490226e19b6d9c09261024c126fd Mon Sep 17 00:00:00 2001 From: Tor Brede Vekterli Date: Fri, 9 Dec 2022 14:58:28 +0000 Subject: Also set `DocumentUpdate::_repo` in non-rvalue init function --- document/src/vespa/document/update/documentupdate.cpp | 8 ++------ document/src/vespa/document/update/documentupdate.h | 6 ++++-- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'document') diff --git a/document/src/vespa/document/update/documentupdate.cpp b/document/src/vespa/document/update/documentupdate.cpp index d6488c1381c..6ab01a4d3ff 100644 --- a/document/src/vespa/document/update/documentupdate.cpp +++ b/document/src/vespa/document/update/documentupdate.cpp @@ -87,15 +87,10 @@ DocumentUpdate::operator==(const DocumentUpdate& other) const } const DocumentType& -DocumentUpdate::getType() const { +DocumentUpdate::getType() const noexcept { return static_cast (*_type); } -const DocumentTypeRepo* -DocumentUpdate::getRepoPtr() const noexcept { - return _repo; -} - const DocumentUpdate::FieldUpdateV & DocumentUpdate::getUpdates() const { ensureDeserialized(); @@ -266,6 +261,7 @@ DocumentUpdate::initHEAD(const DocumentTypeRepo & repo, vespalib::nbostream && s void DocumentUpdate::initHEAD(const DocumentTypeRepo & repo, vespalib::nbostream & stream) { + _repo = &repo; size_t startPos = stream.rp(); vespalib::stringref docId; _type = deserializeHeader(repo, stream, docId); diff --git a/document/src/vespa/document/update/documentupdate.h b/document/src/vespa/document/update/documentupdate.h index 5a7944b1188..d554e66bd1a 100644 --- a/document/src/vespa/document/update/documentupdate.h +++ b/document/src/vespa/document/update/documentupdate.h @@ -99,10 +99,12 @@ public: void eagerDeserialize() const; /** @return The type of document this update is for. */ - const DocumentType& getType() const; + const DocumentType& getType() const noexcept; // Returns pointer to repo used for underlying update, or nullptr if default-constructed - const DocumentTypeRepo* getRepoPtr() const noexcept; + const DocumentTypeRepo* getRepoPtr() const noexcept { + return _repo; + } void serializeHEAD(vespalib::nbostream &stream) const; -- cgit v1.2.3