summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-12-22 13:11:12 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2016-12-22 13:11:12 +0100
commit269af3b147667a384772b2bf586d2bd98731a8c1 (patch)
tree3a34e43792c0e333777b3fbf01140e423d381e6b /vespalib
parent9c6fa5fda02b0dfa3d34e9ba2b56d46f1bf101be (diff)
Only include what you need.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/net/server_socket.cpp1
-rw-r--r--vespalib/src/vespa/vespalib/net/socket.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/net/socket_handle.cpp2
-rwxr-xr-xvespalib/src/vespa/vespalib/testkit/create-test.sh1
-rw-r--r--vespalib/src/vespa/vespalib/testkit/test_comparators.cpp1
-rw-r--r--vespalib/src/vespa/vespalib/testkit/test_hook.cpp3
-rw-r--r--vespalib/src/vespa/vespalib/testkit/test_kit.h1
-rw-r--r--vespalib/src/vespa/vespalib/testkit/test_macros.h2
-rw-r--r--vespalib/src/vespa/vespalib/testkit/test_master.cpp7
-rw-r--r--vespalib/src/vespa/vespalib/testkit/test_master.h7
-rw-r--r--vespalib/src/vespa/vespalib/testkit/test_state_guard.cpp1
-rw-r--r--vespalib/src/vespa/vespalib/testkit/testapp.cpp8
-rw-r--r--vespalib/src/vespa/vespalib/testkit/testapp.h2
-rw-r--r--vespalib/src/vespa/vespalib/testkit/time_bomb.cpp1
-rw-r--r--vespalib/src/vespa/vespalib/websocket/server_socket.h1
-rw-r--r--vespalib/src/vespa/vespalib/websocket/socket.cpp4
-rw-r--r--vespalib/src/vespa/vespalib/websocket/socket.h6
17 files changed, 20 insertions, 30 deletions
diff --git a/vespalib/src/vespa/vespalib/net/server_socket.cpp b/vespalib/src/vespa/vespalib/net/server_socket.cpp
index f97e974ca46..1b026cfa7d4 100644
--- a/vespalib/src/vespa/vespalib/net/server_socket.cpp
+++ b/vespalib/src/vespa/vespalib/net/server_socket.cpp
@@ -1,7 +1,6 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
#include "server_socket.h"
namespace vespalib {
diff --git a/vespalib/src/vespa/vespalib/net/socket.cpp b/vespalib/src/vespa/vespalib/net/socket.cpp
index c98199fc2f0..23a4e5f9765 100644
--- a/vespalib/src/vespa/vespalib/net/socket.cpp
+++ b/vespalib/src/vespa/vespalib/net/socket.cpp
@@ -1,7 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include <vespa/fastos/fastos.h>
#include "socket.h"
namespace vespalib {
diff --git a/vespalib/src/vespa/vespalib/net/socket_handle.cpp b/vespalib/src/vespa/vespalib/net/socket_handle.cpp
index 04af33b5561..3e8afa66584 100644
--- a/vespalib/src/vespa/vespalib/net/socket_handle.cpp
+++ b/vespalib/src/vespa/vespalib/net/socket_handle.cpp
@@ -1,7 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include <vespa/fastos/fastos.h>
#include "socket_handle.h"
namespace vespalib {
diff --git a/vespalib/src/vespa/vespalib/testkit/create-test.sh b/vespalib/src/vespa/vespalib/testkit/create-test.sh
index 4d02c184c98..6aaeb598782 100755
--- a/vespalib/src/vespa/vespalib/testkit/create-test.sh
+++ b/vespalib/src/vespa/vespalib/testkit/create-test.sh
@@ -22,7 +22,6 @@ gen_project_file() {
gen_source() {
echo "generating '$1' ..."
- echo "#include <vespa/fastos/fastos.h>" >> $1
echo "#include <vespa/vespalib/testkit/testapp.h>" >> $1
echo "" >> $1
echo "TEST_SETUP(Test);" >> $1
diff --git a/vespalib/src/vespa/vespalib/testkit/test_comparators.cpp b/vespalib/src/vespa/vespalib/testkit/test_comparators.cpp
index 51641fe5e78..5a1edf4699c 100644
--- a/vespalib/src/vespa/vespalib/testkit/test_comparators.cpp
+++ b/vespalib/src/vespa/vespalib/testkit/test_comparators.cpp
@@ -1,6 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
#include "test_comparators.h"
namespace vespalib {
diff --git a/vespalib/src/vespa/vespalib/testkit/test_hook.cpp b/vespalib/src/vespa/vespalib/testkit/test_hook.cpp
index b70c14ffe2b..ac051e03217 100644
--- a/vespalib/src/vespa/vespalib/testkit/test_hook.cpp
+++ b/vespalib/src/vespa/vespalib/testkit/test_hook.cpp
@@ -1,10 +1,9 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
#include "test_hook.h"
-#include "test_master.h"
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/regexp.h>
+#include <vespa/fastos/thread.h>
namespace vespalib {
diff --git a/vespalib/src/vespa/vespalib/testkit/test_kit.h b/vespalib/src/vespa/vespalib/testkit/test_kit.h
index 2439e0caf1e..57c6f7b05b8 100644
--- a/vespalib/src/vespa/vespalib/testkit/test_kit.h
+++ b/vespalib/src/vespa/vespalib/testkit/test_kit.h
@@ -3,7 +3,6 @@
#pragma once
#include <memory>
-#include <vespa/fastos/fastos.h>
#include "test_macros.h"
#include "test_comparators.h"
#include "test_master.h"
diff --git a/vespalib/src/vespa/vespalib/testkit/test_macros.h b/vespalib/src/vespa/vespalib/testkit/test_macros.h
index fd0e8a981e0..f0a33d5f15c 100644
--- a/vespalib/src/vespa/vespalib/testkit/test_macros.h
+++ b/vespalib/src/vespa/vespalib/testkit/test_macros.h
@@ -2,6 +2,8 @@
#pragma once
+#include <vespa/fastos/app.h>
+
#define TEST_STR(str) #str
#define TEST_CAT_IMPL(a, b) a ## b
#define TEST_CAT(a, b) TEST_CAT_IMPL(a, b)
diff --git a/vespalib/src/vespa/vespalib/testkit/test_master.cpp b/vespalib/src/vespa/vespalib/testkit/test_master.cpp
index 5c3326bbe9d..45906294a99 100644
--- a/vespalib/src/vespa/vespalib/testkit/test_master.cpp
+++ b/vespalib/src/vespa/vespalib/testkit/test_master.cpp
@@ -1,7 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
#include "test_master.h"
+#include <vespa/vespalib/util/barrier.h>
namespace vespalib {
@@ -35,9 +35,8 @@ TestMaster::threadState(const vespalib::LockGuard &)
if (_threadState == 0) {
std::ostringstream threadName;
threadName << "thread-" << _threadStorage.size();
- vespalib::LinkedPtr<ThreadState> thread(new ThreadState(threadName.str()));
- _threadStorage.push_back(thread);
- _threadState = thread.get();
+ _threadStorage.push_back(std::make_unique<ThreadState>(threadName.str()));
+ _threadState = _threadStorage.back().get();
}
return *_threadState;
}
diff --git a/vespalib/src/vespa/vespalib/testkit/test_master.h b/vespalib/src/vespa/vespalib/testkit/test_master.h
index 523c9bd8eec..369b3ea918e 100644
--- a/vespalib/src/vespa/vespalib/testkit/test_master.h
+++ b/vespalib/src/vespa/vespalib/testkit/test_master.h
@@ -3,13 +3,14 @@
#pragma once
#include <vespa/vespalib/util/sync.h>
-#include <vespa/vespalib/util/barrier.h>
-#include <vespa/vespalib/util/linkedptr.h>
#include <string>
#include <vector>
+#include <memory>
namespace vespalib {
+class Barrier;
+
#ifndef IAM_DOXYGEN
/**
* The master of testing.
@@ -71,7 +72,7 @@ private:
std::string _name;
std::string _path_prefix;
SharedState _state;
- std::vector<vespalib::LinkedPtr<ThreadState> > _threadStorage;
+ std::vector<std::unique_ptr<ThreadState> > _threadStorage;
private:
ThreadState &threadState(const vespalib::LockGuard &);
diff --git a/vespalib/src/vespa/vespalib/testkit/test_state_guard.cpp b/vespalib/src/vespa/vespalib/testkit/test_state_guard.cpp
index 0c26d88b1df..18bd6966b8a 100644
--- a/vespalib/src/vespa/vespalib/testkit/test_state_guard.cpp
+++ b/vespalib/src/vespa/vespalib/testkit/test_state_guard.cpp
@@ -1,6 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
#include "test_state_guard.h"
namespace vespalib {
diff --git a/vespalib/src/vespa/vespalib/testkit/testapp.cpp b/vespalib/src/vespa/vespalib/testkit/testapp.cpp
index a4bb01e525c..207e5a18bed 100644
--- a/vespalib/src/vespa/vespalib/testkit/testapp.cpp
+++ b/vespalib/src/vespa/vespalib/testkit/testapp.cpp
@@ -1,6 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
#include "testapp.h"
namespace vespalib {
@@ -10,12 +9,9 @@ TestMaster &TestApp::master(TestMaster::master);
TestApp::TestApp()
: FastOS_Application(),
_name("<unnamed>")
-{
-}
+{ }
-TestApp::~TestApp()
-{
-}
+TestApp::~TestApp() { }
void
TestApp::ReportInit(const char *name)
diff --git a/vespalib/src/vespa/vespalib/testkit/testapp.h b/vespalib/src/vespa/vespalib/testkit/testapp.h
index 5a06736c870..39b2cbcaa0b 100644
--- a/vespalib/src/vespa/vespalib/testkit/testapp.h
+++ b/vespalib/src/vespa/vespalib/testkit/testapp.h
@@ -2,6 +2,7 @@
#pragma once
#include "test_kit.h"
+#include <vespa/fastos/app.h>
#undef TEST_MASTER
#define TEST_MASTER vespalib::TestApp::master
@@ -144,7 +145,6 @@ namespace vespalib {
*
* Simple test example:
* <pre>
- * \#include <vespa/fastos/fastos.h>
* \#include <vespa/vespalib/testkit/testapp.h>
*
* TEST_SETUP(Test)
diff --git a/vespalib/src/vespa/vespalib/testkit/time_bomb.cpp b/vespalib/src/vespa/vespalib/testkit/time_bomb.cpp
index 28cd638e724..284b0c4ffa7 100644
--- a/vespalib/src/vespa/vespalib/testkit/time_bomb.cpp
+++ b/vespalib/src/vespa/vespalib/testkit/time_bomb.cpp
@@ -1,6 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
#include "time_bomb.h"
namespace vespalib {
diff --git a/vespalib/src/vespa/vespalib/websocket/server_socket.h b/vespalib/src/vespa/vespalib/websocket/server_socket.h
index 20e98c1f76c..664056d82dc 100644
--- a/vespalib/src/vespa/vespalib/websocket/server_socket.h
+++ b/vespalib/src/vespa/vespalib/websocket/server_socket.h
@@ -4,6 +4,7 @@
#pragma once
#include "socket.h"
+#include <vespa/fastos/serversocket.h>
namespace vespalib {
namespace ws {
diff --git a/vespalib/src/vespa/vespalib/websocket/socket.cpp b/vespalib/src/vespa/vespalib/websocket/socket.cpp
index c8bf1ec31f8..3bdea494201 100644
--- a/vespalib/src/vespa/vespalib/websocket/socket.cpp
+++ b/vespalib/src/vespa/vespalib/websocket/socket.cpp
@@ -1,13 +1,13 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
#include "socket.h"
+#include <vespa/fastos/socket.h>
namespace vespalib {
namespace ws {
-Socket::Socket(std::unique_ptr<FastOS_Socket> socket)
+Socket::Socket(std::unique_ptr<FastOS_SocketInterface> socket)
: _socket(std::move(socket))
{
}
diff --git a/vespalib/src/vespa/vespalib/websocket/socket.h b/vespalib/src/vespa/vespalib/websocket/socket.h
index 22391386467..cced2a8b505 100644
--- a/vespalib/src/vespa/vespalib/websocket/socket.h
+++ b/vespalib/src/vespa/vespalib/websocket/socket.h
@@ -6,17 +6,19 @@
#include <memory>
#include <vespa/vespalib/stllike/string.h>
+class FastOS_SocketInterface;
+
namespace vespalib {
namespace ws {
class Socket
{
private:
- std::unique_ptr<FastOS_Socket> _socket;
+ std::unique_ptr<FastOS_SocketInterface> _socket;
public:
typedef std::unique_ptr<Socket> UP;
- Socket(std::unique_ptr<FastOS_Socket> socket);
+ Socket(std::unique_ptr<FastOS_SocketInterface> socket);
Socket(const vespalib::string &host, int port);
virtual ~Socket();
ssize_t read(char *buf, size_t len);