diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-07-28 09:38:49 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-07-31 17:29:17 +0200 |
commit | f1bf27f41ec655cf6d5c097daef4dbcebf6ef666 (patch) | |
tree | 9f863537d051a1bf7fe2c7db9c9060eafcfe4167 /document | |
parent | 711cf1ec760d706599b69968f08137116a1e3ac9 (diff) |
Avoid copying
Diffstat (limited to 'document')
-rw-r--r-- | document/src/tests/documenttestcase.cpp | 4 | ||||
-rw-r--r-- | document/src/vespa/document/base/fieldpath.cpp | 2 | ||||
-rw-r--r-- | document/src/vespa/document/base/fieldpath.h | 2 | ||||
-rw-r--r-- | document/src/vespa/document/datatype/datatype.cpp | 2 | ||||
-rw-r--r-- | document/src/vespa/document/datatype/mapdatatype.cpp | 2 |
5 files changed, 6 insertions, 6 deletions
diff --git a/document/src/tests/documenttestcase.cpp b/document/src/tests/documenttestcase.cpp index b2da5e51b74..32503ac0bd0 100644 --- a/document/src/tests/documenttestcase.cpp +++ b/document/src/tests/documenttestcase.cpp @@ -99,10 +99,10 @@ void DocumentTest::testFieldPath() "{\"\"}", "", "" }; for (size_t i(0); i < sizeof(testValues)/sizeof(testValues[0]); i+=3) { - vespalib::string tmp = testValues[i]; + vespalib::stringref tmp = testValues[i]; vespalib::string key = FieldPathEntry::parseKey(tmp); CPPUNIT_ASSERT_EQUAL(testValues[i+1], key); - CPPUNIT_ASSERT_EQUAL(testValues[i+2], tmp); + CPPUNIT_ASSERT_EQUAL(testValues[i+2], vespalib::string(tmp)); } } diff --git a/document/src/vespa/document/base/fieldpath.cpp b/document/src/vespa/document/base/fieldpath.cpp index b173d393316..0d43413e696 100644 --- a/document/src/vespa/document/base/fieldpath.cpp +++ b/document/src/vespa/document/base/fieldpath.cpp @@ -136,7 +136,7 @@ FieldPathEntry::visitMembers(vespalib::ObjectVisitor &visitor) const visit(visitor, "fillInVal", _fillInVal); } -vespalib::string FieldPathEntry::parseKey(vespalib::string & key) +vespalib::string FieldPathEntry::parseKey(vespalib::stringref & key) { vespalib::string v; const char *c = key.c_str(); diff --git a/document/src/vespa/document/base/fieldpath.h b/document/src/vespa/document/base/fieldpath.h index d2a60ebfbed..578b54faf56 100644 --- a/document/src/vespa/document/base/fieldpath.h +++ b/document/src/vespa/document/base/fieldpath.h @@ -92,7 +92,7 @@ public: * @param key is the incoming value, and contains what is left when done. * *return The unescaped value */ - static vespalib::string parseKey(vespalib::string & key); + static vespalib::string parseKey(vespalib::stringref & key); private: void setFillValue(const DataType & dataType); Type _type; diff --git a/document/src/vespa/document/datatype/datatype.cpp b/document/src/vespa/document/datatype/datatype.cpp index 9083a5352ff..08a91e0df64 100644 --- a/document/src/vespa/document/datatype/datatype.cpp +++ b/document/src/vespa/document/datatype/datatype.cpp @@ -171,7 +171,7 @@ DataType::operator<(const DataType& other) const } void -DataType::buildFieldPath(FieldPath & path, const vespalib::stringref & remainFieldName) const +DataType::buildFieldPath(FieldPath & path, const vespalib::stringref & remainFieldName) const { if ( !remainFieldName.empty() ) { path.reserve(4); // Optimize for short paths diff --git a/document/src/vespa/document/datatype/mapdatatype.cpp b/document/src/vespa/document/datatype/mapdatatype.cpp index 6eece4e487d..5c940b1af6e 100644 --- a/document/src/vespa/document/datatype/mapdatatype.cpp +++ b/document/src/vespa/document/datatype/mapdatatype.cpp @@ -61,7 +61,7 @@ MapDataType::buildFieldPathImpl(FieldPath & path, const DataType &dataType, const DataType &keyType, const DataType &valueType) { if (!remainFieldName.empty() && remainFieldName[0] == '{') { - vespalib::string rest = remainFieldName; + vespalib::stringref rest = remainFieldName; vespalib::string keyValue = FieldPathEntry::parseKey(rest); valueType.buildFieldPath(path, (rest[0] == '.') ? rest.substr(1) : rest); |