Skip to content

Commit 9f298d4

Browse files
committed
clang-format
1 parent d203925 commit 9f298d4

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

include/asyncpp/curl/executor.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
#include <map>
1111
#include <mutex>
1212
#include <set>
13+
#include <stop_token>
1314
#include <string>
1415
#include <thread>
15-
#include <stop_token>
1616

1717
namespace asyncpp::curl {
1818
class handle;
@@ -70,14 +70,13 @@ namespace asyncpp::curl {
7070
int m_result{0};
7171

7272
exec_awaiter(executor* exec, handle* hdl, std::stop_token st)
73-
: m_parent(exec), m_handle(hdl), m_callback(std::move(st), stop_callback{exec, hdl})
74-
{}
73+
: m_parent(exec), m_handle(hdl), m_callback(std::move(st), stop_callback{exec, hdl}) {}
7574

7675
constexpr bool await_ready() const noexcept { return false; }
7776
void await_suspend(coroutine_handle<> h) noexcept;
7877
constexpr int await_resume() const noexcept { return m_result; }
7978
};
80-
79+
8180
/**
8281
* \brief Return a awaitable that suspends till the handle is finished.
8382
* \param hdl The handle to await
@@ -114,15 +113,14 @@ namespace asyncpp::curl {
114113
} else {
115114
std::promise<std::invoke_result_t<FN>> promise;
116115
auto result = promise.get_future();
117-
this->push([&promise, &fn](){
118-
try{
116+
this->push([&promise, &fn]() {
117+
try {
119118
if constexpr (std::is_same_v<std::invoke_result_t<FN>, void>) {
120119
fn();
121120
promise.set_value();
122-
} else promise.set_value(fn());
123-
} catch(...) {
124-
promise.set_exception(std::current_exception());
125-
}
121+
} else
122+
promise.set_value(fn());
123+
} catch (...) { promise.set_exception(std::current_exception()); }
126124
});
127125
return result.get();
128126
}

include/asyncpp/curl/webclient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#include <exception>
88
#include <functional>
99
#include <map>
10-
#include <variant>
1110
#include <stop_token>
11+
#include <variant>
1212

1313
namespace asyncpp::curl {
1414
class executor;

src/curl/webclient.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,7 @@ namespace asyncpp::curl {
156156
}
157157

158158
struct http_request::execute_awaiter::data {
159-
data(executor* exec, http_request* req, std::stop_token st)
160-
: m_exec(exec, &m_handle, std::move(st)), m_request(req)
161-
{}
159+
data(executor* exec, http_request* req, std::stop_token st) : m_exec(exec, &m_handle, std::move(st)), m_request(req) {}
162160

163161
executor::exec_awaiter m_exec;
164162
handle m_handle{};
@@ -175,13 +173,11 @@ namespace asyncpp::curl {
175173
if (m_impl) delete m_impl;
176174
}
177175

178-
void http_request::execute_awaiter::await_suspend(coroutine_handle<> h) noexcept {
179-
m_impl->m_exec.await_suspend(h);
180-
}
176+
void http_request::execute_awaiter::await_suspend(coroutine_handle<> h) noexcept { m_impl->m_exec.await_suspend(h); }
181177

182178
http_response http_request::execute_awaiter::await_resume() const {
183179
auto res = m_impl->m_exec.await_resume();
184-
if(res != CURLE_OK) throw exception(res, false);
180+
if (res != CURLE_OK) throw exception(res, false);
185181
m_impl->m_response.status_code = m_impl->m_handle.get_response_code();
186182
return std::move(m_impl->m_response);
187183
}

0 commit comments

Comments
 (0)