summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-08-27 09:53:35 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-08-27 09:53:35 +0000
commit0a5c13aa1ab2117cfb5d70e13313426eb7f1a695 (patch)
treecd6adb9ea10d1ffd0815268082f414562e9cf7e2 /document
parentc7cb8032b3de3dba59a8462cbf4ab82fc7b93c97 (diff)
- If document type has been resolved, use if for test-and-set too.
- Inline small frequently called methods.
Diffstat (limited to 'document')
-rw-r--r--document/src/vespa/document/datatype/structureddatatype.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/document/src/vespa/document/datatype/structureddatatype.cpp b/document/src/vespa/document/datatype/structureddatatype.cpp
index 6553f450134..1b98d912819 100644
--- a/document/src/vespa/document/datatype/structureddatatype.cpp
+++ b/document/src/vespa/document/datatype/structureddatatype.cpp
@@ -48,9 +48,11 @@ int32_t StructuredDataType::createId(vespalib::stringref name)
// ASCII characters. Probably screwed up otherwise, but generated ids
// should only be used in testing anyways. In production this will be
// set from the document manager config.
- vespalib::asciistream ost;
- ost << name << ".0"; // Hardcode version 0 (version is not supported).
- return crappyJavaStringHash(ost.str());
+ char *bufOnStack = static_cast<char *>(alloca(name.size() + 2));
+ memcpy(bufOnStack, name.data(), name.size());
+ bufOnStack[name.size()] = '.';
+ bufOnStack[name.size() + 1] = '0';
+ return crappyJavaStringHash(vespalib::stringref(bufOnStack, name.size() + 2));
}
void