]> granicus.if.org Git - libevent/commitdiff
Make rpc headers self-compilable
authorAzat Khuzhin <a3at.mail@gmail.com>
Sun, 6 May 2018 23:39:44 +0000 (02:39 +0300)
committerAzat Khuzhin <a3at.mail@gmail.com>
Sun, 6 May 2018 23:40:16 +0000 (02:40 +0300)
Fixes: #633
include/event2/rpc.h
include/event2/rpc_struct.h
test/regress_rpc.c

index 830d0c62b1e929e2efd7e25461bd338abe5c6745..e7ada0b614e26768f34d14c1624c7ecca2c54eb5 100644 (file)
@@ -27,6 +27,8 @@
 #ifndef EVENT2_RPC_H_INCLUDED_
 #define EVENT2_RPC_H_INCLUDED_
 
+/* For int types. */
+#include <event2/util.h>
 #include <event2/visibility.h>
 
 #ifdef __cplusplus
index 8f691f49fbcdd912b902dab29f283245046e8456..f3cb460aed413b4238b4ca25de5136088d16252a 100644 (file)
@@ -38,6 +38,16 @@ extern "C" {
 
  */
 
+/* Fix so that people don't have to run with <sys/queue.h> */
+#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
index 01a058cbb2b86facf4196f035bc7257eaac3a4cc..2cb2bcd9bca910b397b140df5655c5947f319c55 100644 (file)
@@ -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"