summaryrefslogtreecommitdiffstats
path: root/staging_vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-08-10 23:34:45 +0200
committerHenning Baldersheim <balder@oath.com>2018-08-10 23:34:45 +0200
commit6ecf0ff7e093eae86292c283bf586c405a557659 (patch)
treedc45738bead7ad07399324f255e2a0dbd38e5fcf /staging_vespalib
parent86139ca05e67c56dfdee0399c4ebc157903f47ea (diff)
Pass stringref by value
Diffstat (limited to 'staging_vespalib')
-rw-r--r--staging_vespalib/src/vespa/vespalib/net/json_handler_repo.cpp8
-rw-r--r--staging_vespalib/src/vespa/vespalib/net/json_handler_repo.h8
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.cpp2
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.h2
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/jsonwriter.cpp6
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/jsonwriter.h6
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/librarypool.cpp6
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/librarypool.h6
8 files changed, 22 insertions, 22 deletions
diff --git a/staging_vespalib/src/vespa/vespalib/net/json_handler_repo.cpp b/staging_vespalib/src/vespa/vespalib/net/json_handler_repo.cpp
index 97bb4a9aac7..3082615c59e 100644
--- a/staging_vespalib/src/vespa/vespalib/net/json_handler_repo.cpp
+++ b/staging_vespalib/src/vespa/vespalib/net/json_handler_repo.cpp
@@ -18,7 +18,7 @@ void remove_seq(T &collection, size_t seq) {
} // namespace vespalib::<unnamed>
size_t
-JsonHandlerRepo::State::bind(const vespalib::stringref &path_prefix,
+JsonHandlerRepo::State::bind(vespalib::stringref path_prefix,
const JsonGetHandler &get_handler)
{
std::lock_guard<std::mutex> guard(lock);
@@ -29,7 +29,7 @@ JsonHandlerRepo::State::bind(const vespalib::stringref &path_prefix,
}
size_t
-JsonHandlerRepo::State::add_root_resource(const vespalib::stringref &path)
+JsonHandlerRepo::State::add_root_resource(vespalib::stringref path)
{
std::lock_guard<std::mutex> guard(lock);
size_t my_seq = ++seq;
@@ -47,14 +47,14 @@ JsonHandlerRepo::State::unbind(size_t my_seq) {
//-----------------------------------------------------------------------------
JsonHandlerRepo::Token::UP
-JsonHandlerRepo::bind(const vespalib::stringref &path_prefix,
+JsonHandlerRepo::bind(vespalib::stringref path_prefix,
const JsonGetHandler &get_handler)
{
return Token::UP(new Unbinder(_state, _state->bind(path_prefix, get_handler)));
}
JsonHandlerRepo::Token::UP
-JsonHandlerRepo::add_root_resource(const vespalib::stringref &path)
+JsonHandlerRepo::add_root_resource(vespalib::stringref path)
{
return Token::UP(new Unbinder(_state, _state->add_root_resource(path)));
}
diff --git a/staging_vespalib/src/vespa/vespalib/net/json_handler_repo.h b/staging_vespalib/src/vespa/vespalib/net/json_handler_repo.h
index b9c8cfdc169..8cca0165cd7 100644
--- a/staging_vespalib/src/vespa/vespalib/net/json_handler_repo.h
+++ b/staging_vespalib/src/vespa/vespalib/net/json_handler_repo.h
@@ -59,9 +59,9 @@ private:
std::vector<Hook> hooks;
std::vector<Resource> root_resources;
State() : lock(), seq(0), hooks(), root_resources() {}
- size_t bind(const vespalib::stringref &path_prefix,
+ size_t bind(vespalib::stringref path_prefix,
const JsonGetHandler &get_handler);
- size_t add_root_resource(const vespalib::stringref &path);
+ size_t add_root_resource(vespalib::stringref path);
void unbind(size_t my_seq);
};
@@ -79,9 +79,9 @@ private:
public:
JsonHandlerRepo() : _state(std::make_shared<State>()) {}
- Token::UP bind(const vespalib::stringref &path_prefix,
+ Token::UP bind(vespalib::stringref path_prefix,
const JsonGetHandler &get_handler);
- Token::UP add_root_resource(const vespalib::stringref &path);
+ Token::UP add_root_resource(vespalib::stringref path);
std::vector<vespalib::string> get_root_resources() const;
vespalib::string get(const vespalib::string &host,
const vespalib::string &path,
diff --git a/staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.cpp b/staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.cpp
index 22064864b22..5276e5c7eb9 100644
--- a/staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.cpp
@@ -69,7 +69,7 @@ GrowableByteBuffer::putDouble(double v)
}
void
-GrowableByteBuffer::putString(const vespalib::stringref& v)
+GrowableByteBuffer::putString(vespalib::stringref v)
{
putInt(v.size());
putBytes(v.data(), v.size());
diff --git a/staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.h b/staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.h
index 787ea0e028e..d65cabd8cb7 100644
--- a/staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.h
+++ b/staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.h
@@ -70,7 +70,7 @@ public:
/**
Adds a string to the buffer.
*/
- void putString(const vespalib::stringref & v);
+ void putString(vespalib::stringref v);
/**
Adds a single byte to the buffer.
diff --git a/staging_vespalib/src/vespa/vespalib/util/jsonwriter.cpp b/staging_vespalib/src/vespa/vespalib/util/jsonwriter.cpp
index 0ad52f9aac2..010b9f57a33 100644
--- a/staging_vespalib/src/vespa/vespalib/util/jsonwriter.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/jsonwriter.cpp
@@ -173,7 +173,7 @@ JSONWriter::appendNull()
}
JSONWriter &
-JSONWriter::appendKey(const vespalib::stringref & str)
+JSONWriter::appendKey(stringref str)
{
considerComma();
indent();
@@ -243,7 +243,7 @@ JSONWriter::appendUInt64(uint64_t v)
}
JSONWriter &
-JSONWriter::appendString(const vespalib::stringref & str)
+JSONWriter::appendString(stringref str)
{
considerComma();
quote(str.data(), str.size());
@@ -252,7 +252,7 @@ JSONWriter::appendString(const vespalib::stringref & str)
}
JSONWriter &
-JSONWriter::appendJSON(const vespalib::stringref & json)
+JSONWriter::appendJSON(stringref json)
{
considerComma();
(*_os) << json;
diff --git a/staging_vespalib/src/vespa/vespalib/util/jsonwriter.h b/staging_vespalib/src/vespa/vespalib/util/jsonwriter.h
index 77a805b3c0d..0e9e3e10bc3 100644
--- a/staging_vespalib/src/vespa/vespalib/util/jsonwriter.h
+++ b/staging_vespalib/src/vespa/vespalib/util/jsonwriter.h
@@ -49,14 +49,14 @@ public:
JSONWriter & beginArray();
JSONWriter & endArray();
JSONWriter & appendNull();
- JSONWriter & appendKey(const stringref & str);
+ JSONWriter & appendKey(stringref str);
JSONWriter & appendBool(bool v);
JSONWriter & appendDouble(double v);
JSONWriter & appendFloat(float v);
JSONWriter & appendInt64(int64_t v);
JSONWriter & appendUInt64(uint64_t v);
- JSONWriter & appendString(const stringref & str);
- JSONWriter & appendJSON(const stringref & json);
+ JSONWriter & appendString(stringref str);
+ JSONWriter & appendJSON(stringref json);
void setPretty() { _pretty = true; };
};
diff --git a/staging_vespalib/src/vespa/vespalib/util/librarypool.cpp b/staging_vespalib/src/vespa/vespalib/util/librarypool.cpp
index 45ba2979dc2..2a3ca21c369 100644
--- a/staging_vespalib/src/vespa/vespalib/util/librarypool.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/librarypool.cpp
@@ -19,7 +19,7 @@ LibraryPool::~LibraryPool()
}
void
-LibraryPool::loadLibrary(const stringref & libName)
+LibraryPool::loadLibrary(stringref libName)
{
LockGuard guard(_lock);
if (_libraries.find(libName) == _libraries.end()) {
@@ -36,7 +36,7 @@ LibraryPool::loadLibrary(const stringref & libName)
}
FastOS_DynamicLibrary *
-LibraryPool::get(const stringref & name)
+LibraryPool::get(stringref name)
{
LockGuard guard(_lock);
LibraryMap::const_iterator found(_libraries.find(name));
@@ -46,7 +46,7 @@ LibraryPool::get(const stringref & name)
}
const FastOS_DynamicLibrary *
-LibraryPool::get(const stringref & name) const
+LibraryPool::get(stringref name) const
{
LockGuard guard(_lock);
LibraryMap::const_iterator found(_libraries.find(name));
diff --git a/staging_vespalib/src/vespa/vespalib/util/librarypool.h b/staging_vespalib/src/vespa/vespalib/util/librarypool.h
index 1d8ea1eabec..f6afeb23e69 100644
--- a/staging_vespalib/src/vespa/vespalib/util/librarypool.h
+++ b/staging_vespalib/src/vespa/vespalib/util/librarypool.h
@@ -20,14 +20,14 @@ public:
* @param name The name of the library to load. That is without the 'lib' prefix and the '.so' extension.
* @throws IllegalArgumentException if there are any errors.
*/
- void loadLibrary(const vespalib::stringref & name);
+ void loadLibrary(stringref name);
/**
* Will return the library requested. NULL if not found.
* @param name The name of the library as given in the @ref loadLibrary call.
* @return The library that has already been loaded. NULL if not found.
*/
- FastOS_DynamicLibrary *get(const vespalib::stringref & name);
- const FastOS_DynamicLibrary *get(const vespalib::stringref & name) const;
+ FastOS_DynamicLibrary *get(stringref name);
+ const FastOS_DynamicLibrary *get(stringref name) const;
private:
typedef std::shared_ptr<FastOS_DynamicLibrary> DynamicLibrarySP;
typedef std::map<vespalib::string, DynamicLibrarySP> LibraryMap;