summaryrefslogtreecommitdiffstats
path: root/messagebus
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-08-10 23:35:50 +0200
committerHenning Baldersheim <balder@oath.com>2018-08-10 23:35:50 +0200
commit822e3e3d0630b3af1d76079da8c3e1d161c3ca1a (patch)
treeb6a4ff21d628a2e0214cabe6917d9dc0b0b620f2 /messagebus
parent4be58f582e0cb3313eedc0abedc86170ab41580c (diff)
Pass stringref by value
Diffstat (limited to 'messagebus')
-rw-r--r--messagebus/src/vespa/messagebus/routing/errordirective.cpp2
-rw-r--r--messagebus/src/vespa/messagebus/routing/errordirective.h2
-rw-r--r--messagebus/src/vespa/messagebus/routing/policydirective.cpp2
-rw-r--r--messagebus/src/vespa/messagebus/routing/policydirective.h2
-rw-r--r--messagebus/src/vespa/messagebus/routing/routedirective.cpp2
-rw-r--r--messagebus/src/vespa/messagebus/routing/routedirective.h2
-rw-r--r--messagebus/src/vespa/messagebus/routing/routeparser.cpp12
-rw-r--r--messagebus/src/vespa/messagebus/routing/routeparser.h13
-rw-r--r--messagebus/src/vespa/messagebus/routing/tcpdirective.cpp2
-rw-r--r--messagebus/src/vespa/messagebus/routing/tcpdirective.h2
-rw-r--r--messagebus/src/vespa/messagebus/routing/verbatimdirective.cpp2
-rw-r--r--messagebus/src/vespa/messagebus/routing/verbatimdirective.h2
12 files changed, 22 insertions, 23 deletions
diff --git a/messagebus/src/vespa/messagebus/routing/errordirective.cpp b/messagebus/src/vespa/messagebus/routing/errordirective.cpp
index c26a76d10c7..76263afe914 100644
--- a/messagebus/src/vespa/messagebus/routing/errordirective.cpp
+++ b/messagebus/src/vespa/messagebus/routing/errordirective.cpp
@@ -6,7 +6,7 @@ using vespalib::make_string;
namespace mbus {
-ErrorDirective::ErrorDirective(const vespalib::stringref &msg) :
+ErrorDirective::ErrorDirective(vespalib::stringref msg) :
_msg(msg)
{ }
diff --git a/messagebus/src/vespa/messagebus/routing/errordirective.h b/messagebus/src/vespa/messagebus/routing/errordirective.h
index 715c6f9327c..32648d0b223 100644
--- a/messagebus/src/vespa/messagebus/routing/errordirective.h
+++ b/messagebus/src/vespa/messagebus/routing/errordirective.h
@@ -22,7 +22,7 @@ public:
*
* @param msg The error message.
*/
- ErrorDirective(const vespalib::stringref &msg);
+ ErrorDirective(vespalib::stringref msg);
/**
* Returns the error string that is to be assigned to the reply.
diff --git a/messagebus/src/vespa/messagebus/routing/policydirective.cpp b/messagebus/src/vespa/messagebus/routing/policydirective.cpp
index 3a95520a18b..64710d99b80 100644
--- a/messagebus/src/vespa/messagebus/routing/policydirective.cpp
+++ b/messagebus/src/vespa/messagebus/routing/policydirective.cpp
@@ -6,7 +6,7 @@ using vespalib::make_string;
namespace mbus {
-PolicyDirective::PolicyDirective(const vespalib::stringref &name, const vespalib::stringref &param) :
+PolicyDirective::PolicyDirective(vespalib::stringref name, const vespalib::stringref &param) :
_name(name),
_param(param)
{ }
diff --git a/messagebus/src/vespa/messagebus/routing/policydirective.h b/messagebus/src/vespa/messagebus/routing/policydirective.h
index 23c53c58121..ef9387e5015 100644
--- a/messagebus/src/vespa/messagebus/routing/policydirective.h
+++ b/messagebus/src/vespa/messagebus/routing/policydirective.h
@@ -25,7 +25,7 @@ public:
* @param name The name of the policy to invoke.
* @param param The parameter to pass to the name constructor.
*/
- PolicyDirective(const vespalib::stringref &name, const vespalib::stringref &param);
+ PolicyDirective(vespalib::stringref name, const vespalib::stringref &param);
~PolicyDirective();
/**
diff --git a/messagebus/src/vespa/messagebus/routing/routedirective.cpp b/messagebus/src/vespa/messagebus/routing/routedirective.cpp
index dc84f8c0711..ce430b7236d 100644
--- a/messagebus/src/vespa/messagebus/routing/routedirective.cpp
+++ b/messagebus/src/vespa/messagebus/routing/routedirective.cpp
@@ -6,7 +6,7 @@ using vespalib::make_string;
namespace mbus {
-RouteDirective::RouteDirective(const vespalib::stringref & name) :
+RouteDirective::RouteDirective(vespalib::stringref name) :
_name(name)
{
// empty
diff --git a/messagebus/src/vespa/messagebus/routing/routedirective.h b/messagebus/src/vespa/messagebus/routing/routedirective.h
index 63661a3a61c..5923699e599 100644
--- a/messagebus/src/vespa/messagebus/routing/routedirective.h
+++ b/messagebus/src/vespa/messagebus/routing/routedirective.h
@@ -23,7 +23,7 @@ public:
*
* @param name The name of the route to insert.
*/
- RouteDirective(const vespalib::stringref &name);
+ RouteDirective(vespalib::stringref name);
/**
* Returns the name of the route to insert.
diff --git a/messagebus/src/vespa/messagebus/routing/routeparser.cpp b/messagebus/src/vespa/messagebus/routing/routeparser.cpp
index 0fb90f0d585..88d5d6e4a0f 100644
--- a/messagebus/src/vespa/messagebus/routing/routeparser.cpp
+++ b/messagebus/src/vespa/messagebus/routing/routeparser.cpp
@@ -18,13 +18,13 @@ RouteParser::isWhitespace(char c)
}
IHopDirective::SP
-RouteParser::createRouteDirective(const stringref &str)
+RouteParser::createRouteDirective(stringref str)
{
return IHopDirective::SP(new RouteDirective(str));
}
IHopDirective::SP
-RouteParser::createTcpDirective(const stringref &str)
+RouteParser::createTcpDirective(stringref str)
{
size_t posP = str.find(":");
if (posP == string::npos || posP == 0) {
@@ -41,7 +41,7 @@ RouteParser::createTcpDirective(const stringref &str)
}
IHopDirective::SP
-RouteParser::createPolicyDirective(const stringref &str)
+RouteParser::createPolicyDirective(stringref str)
{
size_t pos = str.find(":");
if (pos == string::npos) {
@@ -51,19 +51,19 @@ RouteParser::createPolicyDirective(const stringref &str)
}
IHopDirective::SP
-RouteParser::createVerbatimDirective(const stringref &str)
+RouteParser::createVerbatimDirective(stringref str)
{
return IHopDirective::SP(new VerbatimDirective(str));
}
IHopDirective::SP
-RouteParser::createErrorDirective(const stringref &str)
+RouteParser::createErrorDirective(stringref str)
{
return IHopDirective::SP(new ErrorDirective(str));
}
IHopDirective::SP
-RouteParser::createDirective(const stringref &str)
+RouteParser::createDirective(stringref str)
{
if (str.size() > 2 && str[0] == '[') {
return createPolicyDirective(str.substr(1, str.size() - 2));
diff --git a/messagebus/src/vespa/messagebus/routing/routeparser.h b/messagebus/src/vespa/messagebus/routing/routeparser.h
index 8ffba3f6e11..7a0c5a7f14a 100644
--- a/messagebus/src/vespa/messagebus/routing/routeparser.h
+++ b/messagebus/src/vespa/messagebus/routing/routeparser.h
@@ -1,7 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/vespalib/util/sync.h>
#include "hop.h"
#include "route.h"
@@ -15,12 +14,12 @@ namespace mbus {
class RouteParser {
private:
static bool isWhitespace(char c);
- static IHopDirective::SP createDirective(const vespalib::stringref &str);
- static IHopDirective::SP createErrorDirective(const vespalib::stringref &str);
- static IHopDirective::SP createPolicyDirective(const vespalib::stringref &str);
- static IHopDirective::SP createRouteDirective(const vespalib::stringref &str);
- static IHopDirective::SP createTcpDirective(const vespalib::stringref &str);
- static IHopDirective::SP createVerbatimDirective(const vespalib::stringref &str);
+ static IHopDirective::SP createDirective(vespalib::stringref str);
+ static IHopDirective::SP createErrorDirective(vespalib::stringref str);
+ static IHopDirective::SP createPolicyDirective(vespalib::stringref str);
+ static IHopDirective::SP createRouteDirective(vespalib::stringref str);
+ static IHopDirective::SP createTcpDirective(vespalib::stringref str);
+ static IHopDirective::SP createVerbatimDirective(vespalib::stringref str);
public:
/**
diff --git a/messagebus/src/vespa/messagebus/routing/tcpdirective.cpp b/messagebus/src/vespa/messagebus/routing/tcpdirective.cpp
index 2b6774a9412..7dd7672712d 100644
--- a/messagebus/src/vespa/messagebus/routing/tcpdirective.cpp
+++ b/messagebus/src/vespa/messagebus/routing/tcpdirective.cpp
@@ -5,7 +5,7 @@
namespace mbus {
-TcpDirective::TcpDirective(const vespalib::stringref &host, uint32_t port, const vespalib::stringref &session) :
+TcpDirective::TcpDirective(vespalib::stringref host, uint32_t port, const vespalib::stringref &session) :
_host(host),
_port(port),
_session(session)
diff --git a/messagebus/src/vespa/messagebus/routing/tcpdirective.h b/messagebus/src/vespa/messagebus/routing/tcpdirective.h
index 8687298049f..c38d131b6a3 100644
--- a/messagebus/src/vespa/messagebus/routing/tcpdirective.h
+++ b/messagebus/src/vespa/messagebus/routing/tcpdirective.h
@@ -26,7 +26,7 @@ public:
* @param port The port to connect to.
* @param session The session to route to.
*/
- TcpDirective(const vespalib::stringref &host, uint32_t port, const vespalib::stringref &session);
+ TcpDirective(vespalib::stringref host, uint32_t port, const vespalib::stringref &session);
/**
* Returns the host to connect to. This may be an ip address or a name.
diff --git a/messagebus/src/vespa/messagebus/routing/verbatimdirective.cpp b/messagebus/src/vespa/messagebus/routing/verbatimdirective.cpp
index 86f50d897a5..f4c768bfd59 100644
--- a/messagebus/src/vespa/messagebus/routing/verbatimdirective.cpp
+++ b/messagebus/src/vespa/messagebus/routing/verbatimdirective.cpp
@@ -4,7 +4,7 @@
namespace mbus {
-VerbatimDirective::VerbatimDirective(const vespalib::stringref &image) :
+VerbatimDirective::VerbatimDirective(vespalib::stringref image) :
_image(image)
{
// empty
diff --git a/messagebus/src/vespa/messagebus/routing/verbatimdirective.h b/messagebus/src/vespa/messagebus/routing/verbatimdirective.h
index 5745937380e..fe42c35505c 100644
--- a/messagebus/src/vespa/messagebus/routing/verbatimdirective.h
+++ b/messagebus/src/vespa/messagebus/routing/verbatimdirective.h
@@ -22,7 +22,7 @@ public:
*
* @param image The image to assign to this.
*/
- VerbatimDirective(const vespalib::stringref &image);
+ VerbatimDirective(vespalib::stringref image);
/**
* Returns the image to which this is a verbatim match.