From e2732c9063503220e137c37aca48f706da0c29ed Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 7 May 2018 02:39:44 +0300 Subject: [PATCH] Make rpc headers self-compilable Fixes: #633 (cherry picked from commit c57f5c34903b02c6e7378865f71a2b83a5befb96) --- include/event2/rpc.h | 2 ++ include/event2/rpc_struct.h | 14 ++++++++++++++ test/regress_rpc.c | 1 - 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/event2/rpc.h b/include/event2/rpc.h index 830d0c62..e7ada0b6 100644 --- a/include/event2/rpc.h +++ b/include/event2/rpc.h @@ -27,6 +27,8 @@ #ifndef EVENT2_RPC_H_INCLUDED_ #define EVENT2_RPC_H_INCLUDED_ +/* For int types. */ +#include #include #ifdef __cplusplus diff --git a/include/event2/rpc_struct.h b/include/event2/rpc_struct.h index 8f691f49..f3cb460a 100644 --- a/include/event2/rpc_struct.h +++ b/include/event2/rpc_struct.h @@ -38,6 +38,16 @@ extern "C" { */ +/* Fix so that people don't have to run with */ +#ifndef TAILQ_ENTRY +#define EVENT_DEFINED_TQENTRY_ +#define TAILQ_ENTRY(type) \ +struct { \ + struct type *tqe_next; /* next element */ \ + struct type **tqe_prev; /* address of previous next element */ \ +} +#endif /* !TAILQ_ENTRY */ + /** * provides information about the completed RPC request. */ @@ -93,6 +103,10 @@ struct evrpc { struct evrpc_base *base; }; +#ifdef EVENT_DEFINED_TQENTRY_ +#undef TAILQ_ENTRY +#endif + #ifdef __cplusplus } #endif diff --git a/test/regress_rpc.c b/test/regress_rpc.c index 01a058cb..2cb2bcd9 100644 --- a/test/regress_rpc.c +++ b/test/regress_rpc.c @@ -61,7 +61,6 @@ #include "event2/http_compat.h" #include "event2/http_struct.h" #include "event2/rpc.h" -#include "event2/rpc.h" #include "event2/rpc_struct.h" #include "event2/tag.h" #include "log-internal.h" -- 2.40.0