summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-08-23 21:45:36 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-08-23 21:45:36 +0200
commitefa813a34dc4decad2b145002798b9207e9753b8 (patch)
tree191c95698244e817bd962d7c6509205e663d8c45
parentf1376511dc20469576c0e3b2bceac151f9946054 (diff)
All you need is make_string.
-rw-r--r--documentapi/src/vespa/documentapi/common.h1
-rw-r--r--messagebus/src/tests/advancedrouting/advancedrouting.cpp4
-rw-r--r--messagebus/src/tests/messagebus/messagebus.cpp12
-rw-r--r--messagebus/src/tests/messageordering/messageordering.cpp14
-rw-r--r--messagebus/src/tests/routingcontext/routingcontext.cpp37
-rw-r--r--messagebus/src/tests/serviceaddress/serviceaddress.cpp1
-rw-r--r--messagebus/src/tests/shutdown/shutdown.cpp1
-rw-r--r--messagebus/src/vespa/messagebus/testlib/custompolicy.cpp7
-rw-r--r--messagebus/src/vespa/messagebus/testlib/custompolicy.h1
-rw-r--r--persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp14
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp10
-rw-r--r--searchlib/src/vespa/searchlib/features/foreachfeature.cpp11
-rw-r--r--searchlib/src/vespa/searchlib/fef/parametervalidator.cpp26
-rw-r--r--searchlib/src/vespa/searchlib/parsequery/simplequerystack.cpp36
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/common.h5
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/domain.cpp10
-rw-r--r--searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp1
-rw-r--r--storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp2
-rw-r--r--storage/src/vespa/storage/common/bucketoperationlogger.cpp4
-rw-r--r--storage/src/vespa/storage/common/bucketoperationlogger.h6
-rw-r--r--storage/src/vespa/storage/distributor/bucketdbupdater.cpp2
-rw-r--r--storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp6
-rw-r--r--storage/src/vespa/storage/distributor/pendingclusterstate.cpp2
-rw-r--r--storage/src/vespa/storage/distributor/persistencemessagetracker.cpp2
-rw-r--r--storage/src/vespa/storage/persistence/bucketownershipnotifier.cpp2
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp4
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp2
-rw-r--r--storage/src/vespa/storage/persistence/persistencethread.cpp6
-rw-r--r--vbench/src/vbench/core/string.cpp9
-rw-r--r--vespalib/src/tests/stringfmt/fmt.cpp53
-rw-r--r--vespalib/src/vespa/vespalib/util/stringfmt.cpp19
-rw-r--r--vespalib/src/vespa/vespalib/util/vstringfmt.h19
33 files changed, 101 insertions, 229 deletions
diff --git a/documentapi/src/vespa/documentapi/common.h b/documentapi/src/vespa/documentapi/common.h
index 10b43f40394..86652b10dca 100644
--- a/documentapi/src/vespa/documentapi/common.h
+++ b/documentapi/src/vespa/documentapi/common.h
@@ -2,7 +2,6 @@
#pragma once
#include <vespa/vespalib/stllike/string.h>
-#include <vespa/vespalib/util/vstringfmt.h>
namespace documentapi {
diff --git a/messagebus/src/tests/advancedrouting/advancedrouting.cpp b/messagebus/src/tests/advancedrouting/advancedrouting.cpp
index eed792ebf7c..e847fdf3222 100644
--- a/messagebus/src/tests/advancedrouting/advancedrouting.cpp
+++ b/messagebus/src/tests/advancedrouting/advancedrouting.cpp
@@ -11,7 +11,7 @@
#include <vespa/messagebus/testlib/slobrok.h>
#include <vespa/messagebus/testlib/testserver.h>
#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/vespalib/util/vstringfmt.h>
+#include <vespa/vespalib/util/stringfmt.h>
using namespace mbus;
@@ -126,7 +126,7 @@ Test::testAdvanced(TestData &data)
.addHop(HopSpec("bar", "dst/bar"))
.addHop(HopSpec("baz", "dst/baz"))
.addRoute(RouteSpec("baz").addHop("baz"))));
- string route = vespalib::make_vespa_string("[Custom:%s,bar,route:baz,dst/cox,?dst/unknown]",
+ string route = vespalib::make_string("[Custom:%s,bar,route:baz,dst/cox,?dst/unknown]",
data._fooSession->getConnectionSpec().c_str());
EXPECT_TRUE(data._srcSession->send(createMessage("msg"), Route::parse(route)).isAccepted());
diff --git a/messagebus/src/tests/messagebus/messagebus.cpp b/messagebus/src/tests/messagebus/messagebus.cpp
index bcd5d662cea..7434941a900 100644
--- a/messagebus/src/tests/messagebus/messagebus.cpp
+++ b/messagebus/src/tests/messagebus/messagebus.cpp
@@ -2,25 +2,17 @@
#include <vespa/messagebus/destinationsession.h>
#include <vespa/messagebus/emptyreply.h>
-#include <vespa/messagebus/error.h>
#include <vespa/messagebus/errorcode.h>
#include <vespa/messagebus/intermediatesession.h>
#include <vespa/messagebus/messagebus.h>
#include <vespa/messagebus/routablequeue.h>
-#include <vespa/messagebus/routing/route.h>
#include <vespa/messagebus/routing/routingcontext.h>
-#include <vespa/messagebus/routing/routingnodeiterator.h>
-#include <vespa/messagebus/routing/routingspec.h>
-#include <vespa/messagebus/sourcesession.h>
-#include <vespa/messagebus/sourcesessionparams.h>
-#include <vespa/messagebus/testlib/receptor.h>
#include <vespa/messagebus/testlib/simplemessage.h>
#include <vespa/messagebus/testlib/simpleprotocol.h>
-#include <vespa/messagebus/testlib/simplereply.h>
#include <vespa/messagebus/testlib/slobrok.h>
#include <vespa/messagebus/testlib/testserver.h>
#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/vespalib/util/vstringfmt.h>
+#include <vespa/vespalib/util/stringfmt.h>
using namespace mbus;
@@ -377,7 +369,7 @@ Test::testDirectHop()
// Send using name.
ASSERT_TRUE(client->session->send(
Message::UP(new SimpleMessage("empty")),
- Route().addHop(vespalib::make_vespa_string("search/r.%d/c.%d/session", row, col)))
+ Route().addHop(vespalib::make_string("search/r.%d/c.%d/session", row, col)))
.isAccepted());
assertDst(*dst);
assertSrc(*client);
diff --git a/messagebus/src/tests/messageordering/messageordering.cpp b/messagebus/src/tests/messageordering/messageordering.cpp
index 9df36b349a1..7ea31701127 100644
--- a/messagebus/src/tests/messageordering/messageordering.cpp
+++ b/messagebus/src/tests/messageordering/messageordering.cpp
@@ -1,19 +1,13 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/messagebus/messagebus.h>
-#include <vespa/messagebus/sourcesession.h>
-#include <vespa/messagebus/destinationsession.h>
#include <vespa/messagebus/testlib/slobrok.h>
#include <vespa/messagebus/testlib/testserver.h>
-#include <vespa/messagebus/routing/routingspec.h>
#include <vespa/messagebus/testlib/receptor.h>
-#include <vespa/messagebus/sourcesessionparams.h>
#include <vespa/messagebus/testlib/simplemessage.h>
#include <vespa/messagebus/testlib/simplereply.h>
-#include <vespa/messagebus/testlib/simpleprotocol.h>
#include <vespa/messagebus/errorcode.h>
-#include <vespa/vespalib/util/vstringfmt.h>
-#include <stdexcept>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
LOG_SETUP("messageordering_test");
@@ -54,7 +48,7 @@ public:
vespalib::MonitorGuard lock(_mon);
- vespalib::string expected(vespalib::make_vespa_string("%d", _messageCounter));
+ vespalib::string expected(vespalib::make_string("%d", _messageCounter));
LOG(debug, "Got message %p with %s, expecting %s",
msg.get(),
simpleMsg.getValue().c_str(),
@@ -117,7 +111,7 @@ VerifyReplyReceptor::handleReply(Reply::UP reply)
}
LOG(warning, "%s", ss.str().c_str());
} else {
- vespalib::string expected(vespalib::make_vespa_string("%d", _replyCount));
+ vespalib::string expected(vespalib::make_string("%d", _replyCount));
SimpleReply& simpleReply(static_cast<SimpleReply&>(*reply));
if (simpleReply.getValue() != expected) {
std::stringstream ss;
@@ -171,7 +165,7 @@ Test::Main()
// send messages on client
const int messageCount = 10000;
for (int i = 0; i < messageCount; ++i) {
- vespalib::string str(vespalib::make_vespa_string("%d", i));
+ vespalib::string str(vespalib::make_string("%d", i));
//FastOS_Thread::Sleep(1);
SimpleMessage::UP msg(new SimpleMessage(str, true, commonMessageId));
msg->getTrace().setLevel(9);
diff --git a/messagebus/src/tests/routingcontext/routingcontext.cpp b/messagebus/src/tests/routingcontext/routingcontext.cpp
index 3cf8be32f04..12ed456b5a6 100644
--- a/messagebus/src/tests/routingcontext/routingcontext.cpp
+++ b/messagebus/src/tests/routingcontext/routingcontext.cpp
@@ -10,7 +10,8 @@
#include <vespa/messagebus/testlib/slobrok.h>
#include <vespa/messagebus/testlib/testserver.h>
#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/vespalib/util/vstringfmt.h>
+#include <vespa/vespalib/util/stringfmt.h>
+
using namespace mbus;
@@ -20,7 +21,7 @@ using namespace mbus;
//
////////////////////////////////////////////////////////////////////////////////
-using vespalib::make_vespa_string;
+using vespalib::make_string;
static const double TIMEOUT = 120;
@@ -74,32 +75,32 @@ CustomPolicy::select(RoutingContext &ctx)
const std::vector<Route> &all = ctx.getAllRecipients();
if (_factory._expectedAll.size() == all.size()) {
- ctx.trace(1, make_vespa_string("Got %d expected recipients.", (uint32_t)all.size()));
+ ctx.trace(1, make_string("Got %d expected recipients.", (uint32_t)all.size()));
for (std::vector<Route>::const_iterator it = all.begin();
it != all.end(); ++it)
{
if (find(_factory._expectedAll.begin(), _factory._expectedAll.end(), it->toString()) != _factory._expectedAll.end()) {
- ctx.trace(1, make_vespa_string("Got expected recipient '%s'.", it->toString().c_str()));
+ ctx.trace(1, make_string("Got expected recipient '%s'.", it->toString().c_str()));
} else {
reply->addError(Error(ErrorCode::APP_FATAL_ERROR,
- make_vespa_string("Matched recipient '%s' not expected.",
- it->toString().c_str())));
+ make_string("Matched recipient '%s' not expected.",
+ it->toString().c_str())));
}
}
} else {
reply->addError(Error(ErrorCode::APP_FATAL_ERROR,
- make_vespa_string("Expected %d recipients, got %d.",
- (uint32_t)_factory._expectedAll.size(),
- (uint32_t)all.size())));
+ make_string("Expected %d recipients, got %d.",
+ (uint32_t)_factory._expectedAll.size(),
+ (uint32_t)all.size())));
}
if (ctx.getNumRecipients() == all.size()) {
for (uint32_t i = 0; i < all.size(); ++i) {
if (all[i].toString() == ctx.getRecipient(i).toString()) {
- ctx.trace(1, make_vespa_string("getRecipient(%d) matches getAllRecipients()[%d]", i, i));
+ ctx.trace(1, make_string("getRecipient(%d) matches getAllRecipients()[%d]", i, i));
} else {
reply->addError(Error(ErrorCode::APP_FATAL_ERROR,
- make_vespa_string("getRecipient(%d) differs from getAllRecipients()[%d]", i, i)));
+ make_string("getRecipient(%d) differs from getAllRecipients()[%d]", i, i)));
}
}
} else {
@@ -110,23 +111,23 @@ CustomPolicy::select(RoutingContext &ctx)
std::vector<Route> matched;
ctx.getMatchedRecipients(matched);
if (_factory._expectedMatched.size() == matched.size()) {
- ctx.trace(1, make_vespa_string("Got %d expected recipients.", (uint32_t)matched.size()));
+ ctx.trace(1, make_string("Got %d expected recipients.", (uint32_t)matched.size()));
for (std::vector<Route>::iterator it = matched.begin();
it != matched.end(); ++it)
{
if (find(_factory._expectedMatched.begin(), _factory._expectedMatched.end(), it->toString()) != _factory._expectedMatched.end()) {
- ctx.trace(1, make_vespa_string("Got matched recipient '%s'.", it->toString().c_str()));
+ ctx.trace(1, make_string("Got matched recipient '%s'.", it->toString().c_str()));
} else {
reply->addError(Error(ErrorCode::APP_FATAL_ERROR,
- make_vespa_string("Matched recipient '%s' not expected.",
- it->toString().c_str())));
+ make_string("Matched recipient '%s' not expected.",
+ it->toString().c_str())));
}
}
} else {
reply->addError(Error(ErrorCode::APP_FATAL_ERROR,
- make_vespa_string("Expected %d matched recipients, got %d.",
- (uint32_t)_factory._expectedMatched.size(),
- (uint32_t)matched.size())));
+ make_string("Expected %d matched recipients, got %d.",
+ (uint32_t)_factory._expectedMatched.size(),
+ (uint32_t)matched.size())));
}
if (!reply->hasErrors() && _factory._forward) {
diff --git a/messagebus/src/tests/serviceaddress/serviceaddress.cpp b/messagebus/src/tests/serviceaddress/serviceaddress.cpp
index f2f5f5eca76..15a2e9fdac8 100644
--- a/messagebus/src/tests/serviceaddress/serviceaddress.cpp
+++ b/messagebus/src/tests/serviceaddress/serviceaddress.cpp
@@ -17,7 +17,6 @@
#include <vespa/messagebus/routing/routingspec.h>
#include <vespa/messagebus/network/rpcservice.h>
#include <vespa/messagebus/sourcesessionparams.h>
-#include <vespa/vespalib/util/vstringfmt.h>
using namespace mbus;
diff --git a/messagebus/src/tests/shutdown/shutdown.cpp b/messagebus/src/tests/shutdown/shutdown.cpp
index 7bb636cc87e..b5e6cac970e 100644
--- a/messagebus/src/tests/shutdown/shutdown.cpp
+++ b/messagebus/src/tests/shutdown/shutdown.cpp
@@ -12,7 +12,6 @@
#include <vespa/messagebus/testlib/testserver.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/exceptions.h>
-#include <vespa/vespalib/util/vstringfmt.h>
using namespace mbus;
diff --git a/messagebus/src/vespa/messagebus/testlib/custompolicy.cpp b/messagebus/src/vespa/messagebus/testlib/custompolicy.cpp
index 866183769cd..c65e4147389 100644
--- a/messagebus/src/vespa/messagebus/testlib/custompolicy.cpp
+++ b/messagebus/src/vespa/messagebus/testlib/custompolicy.cpp
@@ -1,11 +1,10 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <boost/tokenizer.hpp>
+#include "custompolicy.h"
+#include "simpleprotocol.h"
#include <vespa/messagebus/emptyreply.h>
#include <vespa/messagebus/errorcode.h>
#include <vespa/messagebus/routing/routingcontext.h>
-#include <vespa/vespalib/util/vstringfmt.h>
-#include "custompolicy.h"
-#include "simpleprotocol.h"
+#include <boost/tokenizer.hpp>
#include <vespa/log/log.h>
LOG_SETUP(".custompolicy");
diff --git a/messagebus/src/vespa/messagebus/testlib/custompolicy.h b/messagebus/src/vespa/messagebus/testlib/custompolicy.h
index 827c17f1d23..78c851d175c 100644
--- a/messagebus/src/vespa/messagebus/testlib/custompolicy.h
+++ b/messagebus/src/vespa/messagebus/testlib/custompolicy.h
@@ -3,6 +3,7 @@
#include "simpleprotocol.h"
#include <vespa/messagebus/routing/iroutingpolicy.h>
+#include <vespa/messagebus/routing/route.h>
namespace mbus {
diff --git a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
index 489af79d595..43e1e3e60a1 100644
--- a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
+++ b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
@@ -5,19 +5,19 @@
#include <vespa/document/base/documentid.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/vespalib/util/crc.h>
-#include <vespa/vespalib/util/vstringfmt.h>
#include <vespa/document/fieldset/fieldsetrepo.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
#include <algorithm>
-using std::binary_search;
-using std::lower_bound;
-
#include <vespa/log/log.h>
LOG_SETUP(".dummypersistence");
+using vespalib::make_string;
+using std::binary_search;
+using std::lower_bound;
+
namespace storage::spi::dummy {
BucketContent::BucketContent()
@@ -678,10 +678,8 @@ DummyPersistence::iterate(IteratorId id, uint64_t maxByteSize, Context& ctx) con
it->_leftToIterate.pop_back();
}
if (ctx.shouldTrace(9)) {
- ctx.trace(9, vespalib::make_vespa_string("finished iterate(), returning %zu "
- "documents with %u bytes of data",
- entries.size(),
- currentSize));
+ ctx.trace(9, make_string("finished iterate(), returning %zu documents with %u bytes of data",
+ entries.size(), currentSize));
}
LOG(debug, "finished iterate(%zu, %zu), returning %zu documents "
"with %u bytes of data. %u docs cloned in fast path",
diff --git a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp
index 3750ba03f50..cbfdb4895cc 100644
--- a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp
@@ -5,7 +5,6 @@
#include "feedstates.h"
#include "i_feed_handler_owner.h"
#include "ifeedview.h"
-#include "replaypacketdispatcher.h"
#include "tlcproxy.h"
#include <vespa/document/datatype/documenttype.h>
#include <vespa/documentapi/messagebus/documentprotocol.h>
diff --git a/searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp b/searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp
index 8dfcfead3c2..c377be9f73d 100644
--- a/searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/tlcproxy.cpp
@@ -1,22 +1,20 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "tlcproxy.h"
-#include <vespa/vespalib/objects/nbostream.h>
-#include <vespa/searchlib/common/bitvector.h>
-#include <vespa/document/bucket/bucketid.h>
#include <vespa/vespalib/util/exceptions.h>
+
#include <vespa/log/log.h>
LOG_SETUP(".proton.server.tlcproxy");
using vespalib::nbostream;
+using search::transactionlog::Packet;
namespace proton {
void TlcProxy::commit(search::SerialNum serialNum, search::transactionlog::Type type, const vespalib::nbostream &buf)
{
- search::transactionlog::Packet::Entry
- entry(serialNum, type, vespalib::ConstBufferRef(buf.c_str(), buf.size()));
- search::transactionlog::Packet packet;
+ Packet::Entry entry(serialNum, type, vespalib::ConstBufferRef(buf.c_str(), buf.size()));
+ Packet packet;
packet.add(entry);
packet.close();
if (_tlsDirectWriter != NULL) {
diff --git a/searchlib/src/vespa/searchlib/features/foreachfeature.cpp b/searchlib/src/vespa/searchlib/features/foreachfeature.cpp
index 3cef8c12c6c..a67d8001a36 100644
--- a/searchlib/src/vespa/searchlib/features/foreachfeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/foreachfeature.cpp
@@ -4,18 +4,16 @@
#include "valuefeature.h"
#include "utils.h"
-#include <boost/algorithm/string/replace.hpp>
#include <vespa/searchlib/fef/properties.h>
#include <vespa/vespalib/util/stringfmt.h>
-#include <vespa/vespalib/util/vstringfmt.h>
+#include <boost/algorithm/string/replace.hpp>
#include <vespa/log/log.h>
LOG_SETUP(".features.foreachfeature");
using namespace search::fef;
-namespace search {
-namespace features {
+namespace search::features {
template <typename CO, typename OP>
ForeachExecutor<CO, OP>::ForeachExecutor(const CO & condition, uint32_t numInputs) :
@@ -149,7 +147,7 @@ ForeachBlueprint::setup(const IIndexEnvironment & env,
if (_dimension == TERMS) {
uint32_t maxTerms = util::strToNum<uint32_t>(env.getProperties().lookup(getBaseName(), "maxTerms").get("16"));
for (uint32_t i = 0; i < maxTerms; ++i) {
- defineInput(boost::algorithm::replace_all_copy(feature, variable, vespalib::make_vespa_string("%u", i)));
+ defineInput(boost::algorithm::replace_all_copy(feature, variable, vespalib::make_string("%u", i)));
++_num_inputs;
}
} else {
@@ -186,5 +184,4 @@ ForeachBlueprint::createExecutor(const IQueryEnvironment &, vespalib::Stash &sta
}
-} // namespace features
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp b/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp
index f357df250b4..62c9efc6739 100644
--- a/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp
+++ b/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp
@@ -3,13 +3,12 @@
#include "parametervalidator.h"
#include "fieldtype.h"
#include "fieldinfo.h"
-#include <vespa/vespalib/util/vstringfmt.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <boost/lexical_cast.hpp>
-using vespalib::make_vespa_string;
+using vespalib::make_string;
-namespace search {
-namespace fef {
+namespace search::fef {
using CollectionType = FieldInfo::CollectionType;
@@ -56,27 +55,27 @@ ParameterValidator::validateField(ParameterType::Enum type, ParameterCollection:
{
const FieldInfo * field = _indexEnv.getFieldByName(_params[i]);
if (field == NULL) {
- throw ValidateException(make_vespa_string("Param[%zu]: Field '%s' was not found in the index environment",
+ throw ValidateException(make_string("Param[%zu]: Field '%s' was not found in the index environment",
i, _params[i].c_str()));
}
if (type == ParameterType::INDEX_FIELD) {
if (field->type() != FieldType::INDEX) {
- throw ValidateException(make_vespa_string("Param[%zu]: Expected field '%s' to be an index field, but it was not",
+ throw ValidateException(make_string("Param[%zu]: Expected field '%s' to be an index field, but it was not",
i, _params[i].c_str()));
}
} else if (type == ParameterType::ATTRIBUTE_FIELD) {
if (field->type() != FieldType::ATTRIBUTE) {
- throw ValidateException(make_vespa_string("Param[%zu]: Expected field '%s' to be an attribute field, but it was not",
+ throw ValidateException(make_string("Param[%zu]: Expected field '%s' to be an attribute field, but it was not",
i, _params[i].c_str()));
}
} else if (type == ParameterType::ATTRIBUTE) {
if (!field->hasAttribute()) {
- throw ValidateException(make_vespa_string("Param[%zu]: Expected field '%s' to support attribute lookup, but it does not",
+ throw ValidateException(make_string("Param[%zu]: Expected field '%s' to support attribute lookup, but it does not",
i, _params[i].c_str()));
}
}
if (!checkCollectionType(collection, field->collection())) {
- throw ValidateException(make_vespa_string("Param[%zu]: field '%s' has inappropriate collection type",
+ throw ValidateException(make_string("Param[%zu]: field '%s' has inappropriate collection type",
i, _params[i].c_str()));
}
result.addParameter(Parameter(type, _params[i]).setField(field));
@@ -90,7 +89,7 @@ ParameterValidator::validateNumber(ParameterType::Enum type, size_t i, Result &
int64_t intVal = static_cast<int64_t>(doubleVal);
result.addParameter(Parameter(type, _params[i]).setInteger(intVal).setDouble(doubleVal));
} catch (const boost::bad_lexical_cast &) {
- throw ValidateException(make_vespa_string("Param[%zu]: Could not convert '%s' to a number", i, _params[i].c_str()));
+ throw ValidateException(make_string("Param[%zu]: Could not convert '%s' to a number", i, _params[i].c_str()));
}
}
@@ -103,11 +102,11 @@ ParameterValidator::validate(const ParameterDescriptions::Description & desc)
if (minParams > _params.size() ||
((_params.size() - desc.getParams().size()) % desc.getRepeat() != 0))
{
- throw ValidateException(make_vespa_string("Expected %zd+%zdx parameter(s), but got %zd",
+ throw ValidateException(make_string("Expected %zd+%zdx parameter(s), but got %zd",
minParams, desc.getRepeat(), _params.size()));
}
} else if (desc.getParams().size() != _params.size()) {
- throw ValidateException(make_vespa_string("Expected %zd parameter(s), but got %zd", desc.getParams().size(), _params.size()));
+ throw ValidateException(make_string("Expected %zd parameter(s), but got %zd", desc.getParams().size(), _params.size()));
}
for (size_t i = 0; i < _params.size(); ++i) {
ParamDescItem param = desc.getParam(i);
@@ -160,5 +159,4 @@ ParameterValidator::validate()
return invalid;
}
-} // namespace fef
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/parsequery/simplequerystack.cpp b/searchlib/src/vespa/searchlib/parsequery/simplequerystack.cpp
index cae3e769c5b..6274bd083de 100644
--- a/searchlib/src/vespa/searchlib/parsequery/simplequerystack.cpp
+++ b/searchlib/src/vespa/searchlib/parsequery/simplequerystack.cpp
@@ -8,14 +8,14 @@
* ALL RIGHTS RESERVED
*/
#include "simplequerystack.h"
-#include <vespa/vespalib/util/vstringfmt.h>
#include <vespa/vespalib/util/compress.h>
#include <vespa/vespalib/objects/nbo.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
LOG_SETUP(".search.simplequerystack");
-using vespalib::make_vespa_string;
+using vespalib::make_string;
namespace search {
@@ -174,24 +174,24 @@ SimpleQueryStack::StackbufToString(const vespalib::stringref &theBuf)
int64_t tmpLong(0);
p += vespalib::compress::Integer::decompress(tmpLong, p);
metaStr.append("(w:");
- metaStr.append(make_vespa_string("%ld", tmpLong));
+ metaStr.append(make_string("%ld", tmpLong));
metaStr.append(")");
}
if (search::ParseItem::getFeature_UniqueId(rawtype)) {
p += vespalib::compress::Integer::decompressPositive(tmp, p);
metaStr.append("(u:");
- metaStr.append(make_vespa_string("%ld", tmp));
+ metaStr.append(make_string("%ld", tmp));
metaStr.append(")");
}
if (search::ParseItem::getFeature_Flags(rawtype)) {
flags = *p++;
metaStr.append("(f:");
- metaStr.append(make_vespa_string("%d", flags));
+ metaStr.append(make_string("%d", flags));
metaStr.append(")");
}
if (search::ParseItem::GetCreator(flags) != search::ParseItem::CREA_ORIG) {
metaStr.append("(c:");
- metaStr.append(make_vespa_string("%d", search::ParseItem::GetCreator(flags)));
+ metaStr.append(make_string("%d", search::ParseItem::GetCreator(flags)));
metaStr.append(")");
}
@@ -207,7 +207,7 @@ SimpleQueryStack::StackbufToString(const vespalib::stringref &theBuf)
case search::ParseItem::ITEM_ANY:
p += vespalib::compress::Integer::decompressPositive(tmp, p);
arity = tmp;
- result.append(make_vespa_string("%c/%d~", _G_ItemName[type], arity));
+ result.append(make_string("%c/%d~", _G_ItemName[type], arity));
break;
case search::ParseItem::ITEM_WEAK_AND:
case search::ParseItem::ITEM_NEAR:
@@ -221,9 +221,9 @@ SimpleQueryStack::StackbufToString(const vespalib::stringref &theBuf)
idxRefLen = tmp;
idxRef = p;
p += idxRefLen;
- result.append(make_vespa_string("%c/%d/%d/%d:%.*s~", _G_ItemName[type], arity, arg1, idxRefLen, idxRefLen, idxRef));
+ result.append(make_string("%c/%d/%d/%d:%.*s~", _G_ItemName[type], arity, arg1, idxRefLen, idxRefLen, idxRef));
} else {
- result.append(make_vespa_string("%c/%d/%d~", _G_ItemName[type], arity, arg1));
+ result.append(make_string("%c/%d/%d~", _G_ItemName[type], arity, arg1));
}
break;
@@ -242,7 +242,7 @@ SimpleQueryStack::StackbufToString(const vespalib::stringref &theBuf)
termRefLen = tmp;
termRef = p;
p += termRefLen;
- result.append(make_vespa_string("%c/%d:%.*s/%d:%.*s~", _G_ItemName[type],
+ result.append(make_string("%c/%d:%.*s/%d:%.*s~", _G_ItemName[type],
idxRefLen, idxRefLen, idxRef,
termRefLen, termRefLen, termRef));
break;
@@ -251,14 +251,14 @@ SimpleQueryStack::StackbufToString(const vespalib::stringref &theBuf)
termRefLen = tmp;
termRef = p;
p += termRefLen;
- result.append(make_vespa_string("%c/%d:%.*s~", _G_ItemName[type],
+ result.append(make_string("%c/%d:%.*s~", _G_ItemName[type],
termRefLen, termRefLen, termRef));
break;
case search::ParseItem::ITEM_PURE_WEIGHTED_LONG:
tmp = vespalib::nbo::n2h(*reinterpret_cast<const uint64_t *>(p));
p += sizeof(uint64_t);
- result.append(make_vespa_string("%c/%lu", _G_ItemName[type], tmp));
+ result.append(make_string("%c/%lu", _G_ItemName[type], tmp));
break;
case search::ParseItem::ITEM_PHRASE:
@@ -278,10 +278,10 @@ SimpleQueryStack::StackbufToString(const vespalib::stringref &theBuf)
p += sizeof(double);
double thresholdBoostFactor = vespalib::nbo::n2h(*reinterpret_cast<const double *>(p)); // thresholdBoostFactor
p += sizeof(double);
- result.append(make_vespa_string("%c/%d/%d:%.*s(%u,%f,%f)~", _G_ItemName[type], arity, idxRefLen,
+ result.append(make_string("%c/%d/%d:%.*s(%u,%f,%f)~", _G_ItemName[type], arity, idxRefLen,
idxRefLen, idxRef, targetNumHits, scoreThreshold, thresholdBoostFactor));
} else {
- result.append(make_vespa_string("%c/%d/%d:%.*s~", _G_ItemName[type], arity, idxRefLen,
+ result.append(make_string("%c/%d/%d:%.*s~", _G_ItemName[type], arity, idxRefLen,
idxRefLen, idxRef));
}
break;
@@ -292,25 +292,25 @@ SimpleQueryStack::StackbufToString(const vespalib::stringref &theBuf)
idxRef = p;
p += idxRefLen;
size_t feature_count = ReadCompressedPositiveInt(p);
- result.append(make_vespa_string(
+ result.append(make_string(
"%c/%d:%.*s/%zu(", _G_ItemName[type], idxRefLen, idxRefLen, idxRef, feature_count));
for (size_t i = 0; i < feature_count; ++i) {
vespalib::string key = ReadString(p);
vespalib::string value = ReadString(p);
uint64_t sub_queries = ReadUint64(p);
- result.append(make_vespa_string("%s:%s:%lx", key.c_str(), value.c_str(), sub_queries));
+ result.append(make_string("%s:%s:%lx", key.c_str(), value.c_str(), sub_queries));
if (i < feature_count - 1) {
result.append(',');
}
}
size_t range_feature_count = ReadCompressedPositiveInt(p);
- result.append(make_vespa_string(")/%zu(", range_feature_count));
+ result.append(make_string(")/%zu(", range_feature_count));
for (size_t i = 0; i < range_feature_count; ++i) {
vespalib::string key = ReadString(p);
uint64_t value = ReadUint64(p);
uint64_t sub_queries = ReadUint64(p);
- result.append(make_vespa_string("%s:%zu:%lx", key.c_str(), value, sub_queries));
+ result.append(make_string("%s:%zu:%lx", key.c_str(), value, sub_queries));
if (i < range_feature_count - 1) {
result.append(',');
}
diff --git a/searchlib/src/vespa/searchlib/transactionlog/common.h b/searchlib/src/vespa/searchlib/transactionlog/common.h
index 4b8e6575c4c..65ef8f363c0 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/common.h
+++ b/searchlib/src/vespa/searchlib/transactionlog/common.h
@@ -5,8 +5,7 @@
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/util/buffer.h>
-namespace search {
-namespace transactionlog {
+namespace search::transactionlog {
/// This represents a type of the entry. Fx update,remove
typedef uint32_t Type;
@@ -96,5 +95,3 @@ public:
};
}
-}
-
diff --git a/searchlib/src/vespa/searchlib/transactionlog/domain.cpp b/searchlib/src/vespa/searchlib/transactionlog/domain.cpp
index 82e700620e5..8477098ccc8 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/domain.cpp
+++ b/searchlib/src/vespa/searchlib/transactionlog/domain.cpp
@@ -1,8 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "domain.h"
-#include <limits>
-#include <vespa/vespalib/util/vstringfmt.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/closuretask.h>
@@ -11,7 +9,6 @@ LOG_SETUP(".transactionlog.domain");
using vespalib::string;
using vespalib::make_string;
-using vespalib::make_vespa_string;
using vespalib::LockGuard;
using vespalib::makeTask;
using vespalib::makeClosure;
@@ -20,11 +17,7 @@ using vespalib::MonitorGuard;
using search::common::FileHeaderContext;
using std::runtime_error;
-namespace search
-{
-
-namespace transactionlog
-{
+namespace search::transactionlog {
Domain::Domain(const string &domainName,
const string & baseDir,
@@ -420,4 +413,3 @@ Domain::scanDir()
}
}
-}
diff --git a/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp b/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp
index 03bb1c4e043..bd09371181b 100644
--- a/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp
+++ b/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp
@@ -3,7 +3,6 @@
#include "domainpart.h"
#include <vespa/vespalib/util/crc.h>
#include <vespa/vespalib/xxhash/xxhash.h>
-#include <vespa/vespalib/util/vstringfmt.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/data/fileheader.h>
#include <vespa/searchlib/common/fileheadercontext.h>
diff --git a/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp b/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp
index 677723f591e..fbc2b6d348f 100644
--- a/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp
+++ b/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp
@@ -142,7 +142,7 @@ MapBucketDatabase::update(const Entry& newEntry)
assert(newEntry.valid());
LOG_BUCKET_OPERATION_NO_LOCK(
newEntry.getBucketId(),
- vespalib::make_vespa_string(
+ vespalib::make_string(
"bucketdb insert of %s", newEntry.toString().c_str()));
Entry* found = find(0, 0, newEntry.getBucketId(), true);
diff --git a/storage/src/vespa/storage/common/bucketoperationlogger.cpp b/storage/src/vespa/storage/common/bucketoperationlogger.cpp
index b80f6fb0562..d6df7f928e2 100644
--- a/storage/src/vespa/storage/common/bucketoperationlogger.cpp
+++ b/storage/src/vespa/storage/common/bucketoperationlogger.cpp
@@ -201,7 +201,7 @@ void logBucketDbInsert(uint64_t key, const bucketdb::StorageBucketInfo& entry)
{
LOG_BUCKET_OPERATION_NO_LOCK(
document::BucketId(document::BucketId::keyToBucketId(key)),
- vespalib::make_vespa_string(
+ vespalib::make_string(
"bucketdb insert Bucket(crc=%x, docs=%u, size=%u, "
"metacount=%u, usedfilesize=%u, ready=%s, "
"active=%s, lastModified=%zu) disk=%u",
@@ -308,7 +308,7 @@ logBucketDbInsert(uint64_t key, const BucketInfo& entry)
{
document::BucketId bucket(document::BucketId::keyToBucketId(key));
LOG_BUCKET_OPERATION_NO_LOCK(
- bucket, vespalib::make_vespa_string(
+ bucket, vespalib::make_string(
"bucketdb insert of %s", entry.toString().c_str()));
// Do some sanity checking of the inserted entry
checkAllConsistentNodesImpliesTrusted(bucket, entry);
diff --git a/storage/src/vespa/storage/common/bucketoperationlogger.h b/storage/src/vespa/storage/common/bucketoperationlogger.h
index 5d0d09b5cb5..dce9334a9cf 100644
--- a/storage/src/vespa/storage/common/bucketoperationlogger.h
+++ b/storage/src/vespa/storage/common/bucketoperationlogger.h
@@ -1,13 +1,11 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <string>
-#include <map>
-#include <list>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/util/sync.h>
#include <vespa/document/bucket/bucketid.h>
-#include <vespa/vespalib/util/vstringfmt.h>
+#include <map>
+#include <list>
/**
* Enable this to log most slotfile operations (such as all mutations) as
diff --git a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp
index 0335d679652..67942d3d447 100644
--- a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp
+++ b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp
@@ -693,7 +693,7 @@ BucketDBUpdater::NodeRemover::setCopiesInEntry(
LOG(debug, "Changed %s", e->toString().c_str());
LOG_BUCKET_OPERATION_NO_LOCK(
e.getBucketId(),
- vespalib::make_vespa_string("updated bucketdb entry to %s",
+ vespalib::make_string("updated bucketdb entry to %s",
e->toString().c_str()));
}
diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp b/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp
index 5c69c4576f0..a75a56b63c9 100644
--- a/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/idealstate/splitoperation.cpp
@@ -108,7 +108,7 @@ SplitOperation::onReceive(DistributorMessageSender&, const api::StorageReply::SP
| DatabaseUpdate::RESET_TRUSTED));
LOG_BUCKET_OPERATION_NO_LOCK(
- sinfo.first, vespalib::make_vespa_string(
+ sinfo.first, vespalib::make_string(
"Split from bucket %s: %s",
getBucketId().toString().c_str(),
copy.toString().c_str()));
@@ -140,13 +140,13 @@ SplitOperation::onReceive(DistributorMessageSender&, const api::StorageReply::SP
#ifdef ENABLE_BUCKET_OPERATION_LOGGING
if (_ok) {
LOG_BUCKET_OPERATION_NO_LOCK(
- getBucketId(), vespalib::make_vespa_string(
+ getBucketId(), vespalib::make_string(
"Split OK on node %d: %s. Finished: %s",
node, ost.str().c_str(),
_tracker.finished() ? "yes" : "no"));
} else {
LOG_BUCKET_OPERATION_NO_LOCK(
- getBucketId(), vespalib::make_vespa_string(
+ getBucketId(), vespalib::make_string(
"Split FAILED on node %d: %s. Finished: %s",
node, rep.getResult().toString().c_str(),
_tracker.finished() ? "yes" : "no"));
diff --git a/storage/src/vespa/storage/distributor/pendingclusterstate.cpp b/storage/src/vespa/storage/distributor/pendingclusterstate.cpp
index 2039c1b5177..bd14ded3710 100644
--- a/storage/src/vespa/storage/distributor/pendingclusterstate.cpp
+++ b/storage/src/vespa/storage/distributor/pendingclusterstate.cpp
@@ -425,7 +425,7 @@ PendingClusterState::insertInfo(
LOG_BUCKET_OPERATION_NO_LOCK(
_entries[range.first].bucketId,
- vespalib::make_vespa_string("insertInfo: %s",
+ vespalib::make_string("insertInfo: %s",
info.toString().c_str()));
}
diff --git a/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp b/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp
index 5002c203154..a35a19b4f71 100644
--- a/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp
+++ b/storage/src/vespa/storage/distributor/persistencemessagetracker.cpp
@@ -297,7 +297,7 @@ PersistenceMessageTrackerImpl::handleCreateBucketReply(
_manager.removeNodeFromDB(reply.getBucketId(), node);
LOG_BUCKET_OPERATION_NO_LOCK(
reply.getBucketId(),
- vespalib::make_vespa_string(
+ vespalib::make_string(
"Deleted bucket on node %u due to failing create bucket %s",
node, reply.getResult().toString().c_str()));
}
diff --git a/storage/src/vespa/storage/persistence/bucketownershipnotifier.cpp b/storage/src/vespa/storage/persistence/bucketownershipnotifier.cpp
index 1c79bd83286..c492dd4b55e 100644
--- a/storage/src/vespa/storage/persistence/bucketownershipnotifier.cpp
+++ b/storage/src/vespa/storage/persistence/bucketownershipnotifier.cpp
@@ -89,7 +89,7 @@ BucketOwnershipNotifier::logNotification(const document::BucketId& bucket,
newInfo.toString().c_str());
LOG_BUCKET_OPERATION_NO_LOCK(
bucket,
- vespalib::make_vespa_string(
+ vespalib::make_string(
"Sending notify to distributor %u "
"(ownership changed away from %u)",
currentOwnerIndex, sourceIndex));
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
index e5525e1fd17..e7fa4eadda0 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
@@ -781,7 +781,7 @@ FileStorHandlerImpl::remapMessage(
targetDisk = targets[idx]->diskIndex;
#if defined(ENABLE_BUCKET_OPERATION_LOGGING)
{
- vespalib::string desc = vespalib::make_vespa_string(
+ vespalib::string desc = vespalib::make_string(
"Remapping %s from %s to %s, targetDisk = %u",
cmd.toString().c_str(), source.toString().c_str(),
targets[idx]->bid.toString().c_str(), targetDisk);
@@ -829,7 +829,7 @@ FileStorHandlerImpl::remapMessage(
targetDisk = targets[0]->diskIndex;
#ifdef ENABLE_BUCKET_OPERATION_LOGGING
{
- vespalib::string desc = vespalib::make_vespa_string(
+ vespalib::string desc = vespalib::make_string(
"Remapping %s from %s to %s, targetDisk = %u",
cmd.toString().c_str(), source.toString().c_str(),
targets[0]->bid.toString().c_str(), targetDisk);
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
index 47575229fb3..1e74c957b01 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
@@ -271,7 +271,7 @@ FileStorManager::handlePersistenceMessage(
LOG_BUCKET_OPERATION_NO_LOCK(
getStorageMessageBucketId(*msg),
- vespalib::make_vespa_string("Attempting to queue %s to disk %u",
+ vespalib::make_string("Attempting to queue %s to disk %u",
msg->toString().c_str(), disk));
diff --git a/storage/src/vespa/storage/persistence/persistencethread.cpp b/storage/src/vespa/storage/persistence/persistencethread.cpp
index fa8231d5353..4755795526a 100644
--- a/storage/src/vespa/storage/persistence/persistencethread.cpp
+++ b/storage/src/vespa/storage/persistence/persistencethread.cpp
@@ -567,7 +567,7 @@ PersistenceThread::handleSplitBucket(api::SplitBucketCommand& cmd)
#ifdef ENABLE_BUCKET_OPERATION_LOGGING
{
vespalib::string desc(
- vespalib::make_vespa_string(
+ vespalib::make_string(
"split(%s -> %s, %s)",
cmd.getBucketId().toString().c_str(),
target1.toString().c_str(),
@@ -743,7 +743,7 @@ PersistenceThread::handleJoinBuckets(api::JoinBucketsCommand& cmd)
#ifdef ENABLE_BUCKET_OPERATION_LOGGING
{
vespalib::string desc(
- vespalib::make_vespa_string(
+ vespalib::make_string(
"join(%s, %s -> %s)",
firstBucket.toString().c_str(),
secondBucket.toString().c_str(),
@@ -1149,7 +1149,7 @@ PersistenceThread::flushAllReplies(
}
LOG_BUCKET_OPERATION(
bucketId,
- vespalib::make_vespa_string(
+ vespalib::make_string(
"flushing %zu operations (%zu puts, %zu removes, "
"%zu other)",
replies.size(), nputs, nremoves, nother));
diff --git a/vbench/src/vbench/core/string.cpp b/vbench/src/vbench/core/string.cpp
index 0884ca1946c..3a9ed24563f 100644
--- a/vbench/src/vbench/core/string.cpp
+++ b/vbench/src/vbench/core/string.cpp
@@ -1,12 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "string.h"
-
-#if USE_VESPA_STRING
-#include <vespa/vespalib/util/vstringfmt.h>
-#else
#include <vespa/vespalib/util/stringfmt.h>
-#endif
namespace vbench {
@@ -14,11 +9,7 @@ string strfmt(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
-#if USE_VESPA_STRING
- string ret = vespalib::make_vespa_string_va(fmt, ap);
-#else
string ret = vespalib::make_string_va(fmt, ap);
-#endif
va_end(ap);
return ret;
}
diff --git a/vespalib/src/tests/stringfmt/fmt.cpp b/vespalib/src/tests/stringfmt/fmt.cpp
index 782486886d5..f9bd0ae12fb 100644
--- a/vespalib/src/tests/stringfmt/fmt.cpp
+++ b/vespalib/src/tests/stringfmt/fmt.cpp
@@ -1,31 +1,11 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/util/stringfmt.h>
-#include <vespa/vespalib/util/vstringfmt.h>
-#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/testkit/test_kit.h>
using vespalib::make_string;
-using vespalib::make_vespa_string;
-class Test : public vespalib::TestApp
-{
-public:
- void testSimple();
- int Main() override;
-};
-
-static bool eq(const vespalib::string& a, const vespalib::string& b)
-{
- if (a == b) {
- return true;
- } else {
- return false;
- }
-}
-
-
-void
-Test::testSimple()
+TEST("test that make_string formats as one can expect.")
{
int i=7;
int j=0x666;
@@ -39,27 +19,13 @@ Test::testSimple()
EXPECT_TRUE(tst == foo);
EXPECT_TRUE(tst == bar);
- vespalib::string foo_v = make_vespa_string("%d/%x", i, j);
- vespalib::string bar_v = make_vespa_string("%d/%x", i, j).c_str();
- vespalib::string tst_v = tst;
-
- EXPECT_TRUE(tst_v == foo_v);
- EXPECT_TRUE(tst_v == bar_v);
-
EXPECT_TRUE(tst == make_string("%d/%x", i, j));
- EXPECT_TRUE(tst_v == make_vespa_string("%d/%x", i, j));
tst = "a test ";
- tst_v = tst;
EXPECT_TRUE(tst == make_string("%s", s));
- EXPECT_TRUE(tst_v == make_vespa_string("%s", s));
tst = "a t";
EXPECT_TRUE(tst == make_string("%.3s", s));
- tst_v = tst;
- foo_v = make_vespa_string("%.3s", s);
- EXPECT_TRUE(eq(tst, make_string("%.3s", s)));
- EXPECT_TRUE(eq(tst_v, make_vespa_string("%.3s", s)));
const char *p = "really really really really "
"very very very very very "
@@ -70,18 +36,7 @@ Test::testSimple()
"hugely hugely hugely hugely "
"bloated fat long string";
tst = p;
- EXPECT_TRUE(eq(tst, make_string("%s", p)));
- tst_v = tst;
- EXPECT_TRUE(eq(tst_v, make_vespa_string("%s", p)));
-}
-
-
-int
-Test::Main()
-{
- TEST_INIT("stringfmt_test");
- testSimple();
- TEST_DONE();
+ EXPECT_TRUE(tst == make_string("%s", p));
}
-TEST_APPHOOK(Test)
+TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/vespalib/src/vespa/vespalib/util/stringfmt.cpp b/vespalib/src/vespa/vespalib/util/stringfmt.cpp
index 1b2af46c670..266fb60714d 100644
--- a/vespalib/src/vespa/vespalib/util/stringfmt.cpp
+++ b/vespalib/src/vespa/vespalib/util/stringfmt.cpp
@@ -1,14 +1,13 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "stringfmt.h"
-#include "vstringfmt.h"
#include <cassert>
namespace vespalib {
//-----------------------------------------------------------------------------
-vespalib::string make_vespa_string_va(const char *fmt, va_list ap)
+vespalib::string make_string_va(const char *fmt, va_list ap)
{
va_list ap2;
vespalib::string ret;
@@ -42,27 +41,13 @@ vespalib::string make_vespa_string_va(const char *fmt, va_list ap)
* @param fmt format string
* @return formatted vespalib::string
**/
-vespalib::string make_vespa_string(const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- vespalib::string ret = make_vespa_string_va(fmt, ap);
- va_end(ap);
- return ret;
-}
-
vespalib::string make_string(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
- vespalib::string ret = make_vespa_string_va(fmt, ap);
+ vespalib::string ret = make_string_va(fmt, ap);
va_end(ap);
return ret;
}
-vespalib::string make_string_va(const char *fmt, va_list ap)
-{
- return make_vespa_string_va(fmt, ap);
-}
-
} // namespace vespalib
diff --git a/vespalib/src/vespa/vespalib/util/vstringfmt.h b/vespalib/src/vespa/vespalib/util/vstringfmt.h
deleted file mode 100644
index f2dff7e8394..00000000000
--- a/vespalib/src/vespa/vespalib/util/vstringfmt.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#pragma once
-
-#include <stdarg.h>
-#include <vespa/vespalib/stllike/string.h>
-
-namespace vespalib {
-
-extern vespalib::string make_vespa_string_va(const char *fmt, va_list ap);
-
-extern vespalib::string make_vespa_string(const char *fmt, ...)
-#ifdef __GNUC__
- // Add printf format checks with gcc
- __attribute__ ((format (printf,1,2)))
-#endif
- ;
-
-} // namespace vespalib
-