From eb05777d8823f4f6a8ce385f97bf98efef639b5a Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 24 Apr 2015 00:16:14 +0900 Subject: [PATCH] clang-format --- examples/libevent-client.c | 3 +-- src/asio_io_service_pool.cc | 6 +++--- src/asio_server.cc | 10 ++-------- src/asio_server_http2.cc | 18 +++++------------- src/asio_server_http2_impl.cc | 12 ++++-------- src/asio_server_http2_impl.h | 8 +++----- src/comp_helper.c | 2 +- src/util.cc | 4 ++-- 8 files changed, 21 insertions(+), 42 deletions(-) diff --git a/examples/libevent-client.c b/examples/libevent-client.c index 98c194a6..4cda9b6f 100644 --- a/examples/libevent-client.c +++ b/examples/libevent-client.c @@ -258,8 +258,7 @@ static int on_data_chunk_recv_callback(nghttp2_session *session _U_, stream), if it is closed, we send GOAWAY and tear down the session */ static int on_stream_close_callback(nghttp2_session *session, int32_t stream_id, - uint32_t error_code, - void *user_data) { + uint32_t error_code, void *user_data) { http2_session_data *session_data = (http2_session_data *)user_data; int rv; diff --git a/src/asio_io_service_pool.cc b/src/asio_io_service_pool.cc index b6735df0..ba405412 100644 --- a/src/asio_io_service_pool.cc +++ b/src/asio_io_service_pool.cc @@ -58,9 +58,9 @@ void io_service_pool::run(bool asynchronous) { // Create a pool of threads to run all of the io_services. for (std::size_t i = 0; i < io_services_.size(); ++i) { futures_.push_back(std::async(std::launch::async, - (size_t (boost::asio::io_service::*)(void)) & - boost::asio::io_service::run, - io_services_[i])); + (size_t (boost::asio::io_service::*)(void)) & + boost::asio::io_service::run, + io_services_[i])); } if (!asynchronous) { diff --git a/src/asio_server.cc b/src/asio_server.cc index 1f10cd5f..310e672c 100644 --- a/src/asio_server.cc +++ b/src/asio_server.cc @@ -156,15 +156,9 @@ void server::start_accept(tcp::acceptor &acceptor, serve_mux &mux) { }); } -void server::stop() -{ - io_service_pool_.stop(); -} +void server::stop() { io_service_pool_.stop(); } -void server::join() -{ - io_service_pool_.join(); -} +void server::join() { io_service_pool_.join(); } } // namespace server } // namespace asio_http2 diff --git a/src/asio_server_http2.cc b/src/asio_server_http2.cc index 85e50221..7d162e34 100644 --- a/src/asio_server_http2.cc +++ b/src/asio_server_http2.cc @@ -59,11 +59,9 @@ boost::system::error_code http2::listen_and_serve(boost::system::error_code &ec, return impl_->listen_and_serve(ec, nullptr, address, port, asynchronous); } -boost::system::error_code -http2::listen_and_serve(boost::system::error_code &ec, - boost::asio::ssl::context &tls_context, - const std::string &address, const std::string &port, - bool asynchronous) { +boost::system::error_code http2::listen_and_serve( + boost::system::error_code &ec, boost::asio::ssl::context &tls_context, + const std::string &address, const std::string &port, bool asynchronous) { return impl_->listen_and_serve(ec, &tls_context, address, port, asynchronous); } @@ -75,15 +73,9 @@ bool http2::handle(std::string pattern, request_cb cb) { return impl_->handle(std::move(pattern), std::move(cb)); } -void http2::stop() -{ - impl_->stop(); -} +void http2::stop() { impl_->stop(); } -void http2::join() -{ - return impl_->join(); -} +void http2::join() { return impl_->join(); } } // namespace server diff --git a/src/asio_server_http2_impl.cc b/src/asio_server_http2_impl.cc index 142f418c..79994a83 100644 --- a/src/asio_server_http2_impl.cc +++ b/src/asio_server_http2_impl.cc @@ -43,7 +43,8 @@ boost::system::error_code http2_impl::listen_and_serve( boost::system::error_code &ec, boost::asio::ssl::context *tls_context, const std::string &address, const std::string &port, bool asynchronous) { server_.reset(new server(num_threads_)); - return server_->listen_and_serve(ec, tls_context, address, port, backlog_, mux_, asynchronous); + return server_->listen_and_serve(ec, tls_context, address, port, backlog_, + mux_, asynchronous); } void http2_impl::num_threads(size_t num_threads) { num_threads_ = num_threads; } @@ -54,14 +55,9 @@ bool http2_impl::handle(std::string pattern, request_cb cb) { return mux_.handle(std::move(pattern), std::move(cb)); } -void http2_impl::stop() { - return server_->stop(); -} +void http2_impl::stop() { return server_->stop(); } -void http2_impl::join() -{ - return server_->join(); -} +void http2_impl::join() { return server_->join(); } } // namespace server diff --git a/src/asio_server_http2_impl.h b/src/asio_server_http2_impl.h index 244486fa..e4068694 100644 --- a/src/asio_server_http2_impl.h +++ b/src/asio_server_http2_impl.h @@ -42,11 +42,9 @@ class server; class http2_impl { public: http2_impl(); - boost::system::error_code - listen_and_serve(boost::system::error_code &ec, - boost::asio::ssl::context *tls_context, - const std::string &address, const std::string &port, - bool asynchronous); + boost::system::error_code listen_and_serve( + boost::system::error_code &ec, boost::asio::ssl::context *tls_context, + const std::string &address, const std::string &port, bool asynchronous); void num_threads(size_t num_threads); void backlog(int backlog); bool handle(std::string pattern, request_cb cb); diff --git a/src/comp_helper.c b/src/comp_helper.c index d697c6a0..8e0c03dd 100644 --- a/src/comp_helper.c +++ b/src/comp_helper.c @@ -58,7 +58,7 @@ json_t *dump_header(const uint8_t *name, size_t namelen, const uint8_t *value, json_t *nv_pair = json_object(); char *cname = malloc(namelen + 1); if (cname == NULL) { - return NULL; + return NULL; } memcpy(cname, name, namelen); cname[namelen] = '\0'; diff --git a/src/util.cc b/src/util.cc index acaf1f9f..2926ae9e 100644 --- a/src/util.cc +++ b/src/util.cc @@ -738,14 +738,14 @@ char *get_exec_path(int argc, char **const argv, const char *cwd) { if (argv0[0] == '/') { path = static_cast(malloc(len + 1)); if (path == nullptr) { - return nullptr; + return nullptr; } memcpy(path, argv0, len + 1); } else { auto cwdlen = strlen(cwd); path = static_cast(malloc(len + 1 + cwdlen + 1)); if (path == nullptr) { - return nullptr; + return nullptr; } memcpy(path, cwd, cwdlen); path[cwdlen] = '/';