summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-09-21 17:44:23 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2016-09-21 17:44:23 +0000
commitd9611c1538ff90fa5ece7a6d65d81e34498b2a45 (patch)
tree9841f3d311b57f88f61ec3b794bbcb086df75c31 /document
parent6e63d96477dd7978e43e4a3f277129ab90f1657f (diff)
Cheaper version legality check
Diffstat (limited to 'document')
-rw-r--r--document/src/vespa/document/fieldvalue/document.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/document/src/vespa/document/fieldvalue/document.cpp b/document/src/vespa/document/fieldvalue/document.cpp
index 263ed07bc19..6681601ac52 100644
--- a/document/src/vespa/document/fieldvalue/document.cpp
+++ b/document/src/vespa/document/fieldvalue/document.cpp
@@ -26,7 +26,9 @@ LOG_SETUP(".document.fieldvalue.document");
namespace document {
namespace {
-const std::set<uint16_t> ALLOWED_VERSIONS({6, 7, 8});
+bool isLegalVersion(uint16_t version) {
+ return (6 <= version) && (version <= 8);
+}
void documentTypeError(const vespalib::stringref & name) __attribute__((noinline));
void throwTypeMismatch(vespalib::stringref type, vespalib::stringref docidType) __attribute__((noinline));
@@ -337,7 +339,7 @@ Document::deserializeDocHeader(ByteBuffer& buffer, DocumentId& id) {
int32_t len;
buffer.getShortNetwork(version);
- if (ALLOWED_VERSIONS.find(version) == ALLOWED_VERSIONS.end()) {
+ if ( ! isLegalVersion(version) ) {
versionError(version);
} else if (version < 7) {
int64_t tmpLen = 0;