diff options
author | Tyler Brock <tyler.brock@gmail.com> | 2015-02-06 14:29:45 -0500 |
---|---|---|
committer | Tyler Brock <tyler.brock@gmail.com> | 2015-02-06 16:37:35 -0500 |
commit | aa9980b8c02de71c6918fba4aba9f22dd10eed01 (patch) | |
tree | 3ade9078069c7e1317a8b31c2e1fc427977d7abe /src/mongo/db/namespace_string-inl.h | |
parent | 3a7675bb6fa110a10be307db3201bfb348cf41cf (diff) | |
download | mongo-aa9980b8c02de71c6918fba4aba9f22dd10eed01.tar.gz |
SERVER-16940 Change pass-by-const-ref of StringData to pass-by-value
Diffstat (limited to 'src/mongo/db/namespace_string-inl.h')
-rw-r--r-- | src/mongo/db/namespace_string-inl.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/mongo/db/namespace_string-inl.h b/src/mongo/db/namespace_string-inl.h index 49c34ba9373..5f1b25c3113 100644 --- a/src/mongo/db/namespace_string-inl.h +++ b/src/mongo/db/namespace_string-inl.h @@ -43,21 +43,21 @@ namespace mongo { StringData( _ns.c_str() + _dotIndex + 1, _ns.size() - 1 - _dotIndex ); } - inline bool NamespaceString::normal(const StringData& ns) { + inline bool NamespaceString::normal(StringData ns) { if ( ns.find( '$' ) == std::string::npos ) return true; return oplog(ns); } - inline bool NamespaceString::oplog(const StringData& ns) { + inline bool NamespaceString::oplog(StringData ns) { return ns.startsWith("local.oplog."); } - inline bool NamespaceString::special(const StringData& ns) { + inline bool NamespaceString::special(StringData ns) { return !normal(ns) || ns.substr(ns.find('.')).startsWith(".system."); } - inline bool NamespaceString::validDBName( const StringData& db ) { + inline bool NamespaceString::validDBName( StringData db ) { if ( db.size() == 0 || db.size() > 64 ) return false; @@ -87,7 +87,7 @@ namespace mongo { return true; } - inline bool NamespaceString::validCollectionComponent(const StringData& ns){ + inline bool NamespaceString::validCollectionComponent(StringData ns){ size_t idx = ns.find( '.' ); if ( idx == std::string::npos ) return false; @@ -95,7 +95,7 @@ namespace mongo { return validCollectionName(ns.substr(idx + 1)) || oplog(ns); } - inline bool NamespaceString::validCollectionName(const StringData& coll){ + inline bool NamespaceString::validCollectionName(StringData coll){ if (coll.empty()) return false; @@ -117,13 +117,13 @@ namespace mongo { } inline NamespaceString::NamespaceString() : _ns(), _dotIndex(0) {} - inline NamespaceString::NamespaceString( const StringData& nsIn ) { + inline NamespaceString::NamespaceString( StringData nsIn ) { _ns = nsIn.toString(); // copy to our buffer _dotIndex = _ns.find( '.' ); } - inline NamespaceString::NamespaceString( const StringData& dbName, - const StringData& collectionName ) + inline NamespaceString::NamespaceString( StringData dbName, + StringData collectionName ) : _ns(dbName.size() + collectionName.size() + 1, '\0') { uassert(17235, @@ -187,7 +187,7 @@ namespace mongo { } /* future : this doesn't need to be an inline. */ - inline std::string NamespaceString::getSisterNS( const StringData& local ) const { + inline std::string NamespaceString::getSisterNS( StringData local ) const { verify( local.size() && local[0] != '.' ); return db().toString() + "." + local.toString(); } |