Skip to content

Commit 1ae86ec

Browse files
committed
Changed event RAII helper functions to inline to deal with duplicate symbol linker errors.
1 parent fd369d2 commit 1ae86ec

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/support/events.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,26 @@ MAKE_RAII(evhttp);
2727
MAKE_RAII(evhttp_request);
2828
MAKE_RAII(evhttp_connection);
2929

30-
raii_event_base obtain_event_base() {
30+
inline raii_event_base obtain_event_base() {
3131
auto result = raii_event_base(event_base_new());
3232
if (!result.get())
3333
throw std::runtime_error("cannot create event_base");
3434
return result;
3535
}
3636

37-
raii_event obtain_event(struct event_base* base, evutil_socket_t s, short events, event_callback_fn cb, void* arg) {
37+
inline raii_event obtain_event(struct event_base* base, evutil_socket_t s, short events, event_callback_fn cb, void* arg) {
3838
return raii_event(event_new(base, s, events, cb, arg));
3939
}
4040

41-
raii_evhttp obtain_evhttp(struct event_base* base) {
41+
inline raii_evhttp obtain_evhttp(struct event_base* base) {
4242
return raii_evhttp(evhttp_new(base));
4343
}
4444

45-
raii_evhttp_request obtain_evhttp_request(void(*cb)(struct evhttp_request *, void *), void *arg) {
45+
inline raii_evhttp_request obtain_evhttp_request(void(*cb)(struct evhttp_request *, void *), void *arg) {
4646
return raii_evhttp_request(evhttp_request_new(cb, arg));
4747
}
4848

49-
raii_evhttp_connection obtain_evhttp_connection_base(struct event_base* base, std::string host, uint16_t port) {
49+
inline raii_evhttp_connection obtain_evhttp_connection_base(struct event_base* base, std::string host, uint16_t port) {
5050
auto result = raii_evhttp_connection(evhttp_connection_base_new(base, NULL, host.c_str(), port));
5151
if (!result.get())
5252
throw std::runtime_error("create connection failed");

0 commit comments

Comments
 (0)