Re: [Libevent-users] [PATCH] TAILQ_ENTRY missing in evhttp.h on linux

2007-11-03 Thread Niels Provos
Try

#include sys/queue.h

before including evhttp.h

Niels.

On 10/30/07, Paul Fisher [EMAIL PROTECTED] wrote:



 In using the latest 1.3e on linux, evhttp.h fails to compile because of a
 missing definition of TAILQ_ENTRY in evhttp.h.  This is due to the fact that
 the workaround in event.h is #define'd and #undef'd within event.h and not
 available to evhttp.h when defining struct evhttp_request.  This patch
 obviously fixes it:

  --- libevent-1.3e/evhttp.h  2007-08-25 13:49:22.0 -0500
  +++ libevent-1.3e.002/evhttp.h  2007-10-29 22:32:07.0 -0500
  @@ -108,7 +108,14 @@
* reasonable accessors.
*/
   struct evhttp_request {
  +#if defined(TAILQ_ENTRY)
  TAILQ_ENTRY(evhttp_request) next;
  +#else
  +struct {   \
  +   struct type *tqe_next;  /* next element */  \
  +   struct type **tqe_prev; /* address of previous next element */  \
  +}   next;
  +#endif

  /* the connection object that this request belongs to */
  struct evhttp_connection *evcon;

  ... but it would be nice if this was coordinated with the definition in
 event.h, possibly by simply not #undef'ing it from event.h.  Anyway, if
 there is a preference on how to fix this, I'd be glad to regenerate the
 patch.


  --

  paul
 ___
 Libevent-users mailing list
 Libevent-users@monkey.org
 http://monkey.org/mailman/listinfo/libevent-users


___
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users


Re: [Libevent-users] [PATCH] TAILQ_ENTRY missing in evhttp.h on linux

2007-11-03 Thread Christopher Layne
On Sat, Nov 03, 2007 at 04:56:07PM -0700, Niels Provos wrote:
 Try
 
 #include sys/queue.h
 
 before including evhttp.h
 
 Niels.

Why is this a usercode issue? Shouldn't evhttp.h be more interested in
handling it's dependencies than non-event parent code? It's similar to the
sys/time.h being a usercode, but event.h dependency as well. I mean why
not make the parent code just handle all includes for event.h and evhttp.h
- down to stdint.h while we're at it? Because that would be ridiculous -
and the child header should handle it's own dependencies. I know Rob Pike
may have thought at one time one shouldn't include other include files -
but that was also 1989.

-cl
___
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users


Re: [Libevent-users] [PATCH] TAILQ_ENTRY missing in evhttp.h on linux

2007-11-03 Thread Christopher Layne
On Sat, Nov 03, 2007 at 05:53:42PM -0700, Niels Provos wrote:
 Well, Rob Pike has many great insights.  He also does not like
 conditional compilation.  However, you are right, evhttp.h could
 resolve the dependency on queue.h internally.  I will look into it.

Agreed, Rob Pike is true blue - and I also respect him greatly - but what
he wrote back then (including the grumble about not using include guards)
just doesn't hold today. If one thinks about it in an abstract sense, it's
inverting the child-module dependency maintenance onto the parent module. It
was also somewhat hypocritical in that it was a form of compiler lexical
analyzer pre-optimization in it's own right.

-cl
___
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users


[Libevent-users] [PATCH] TAILQ_ENTRY missing in evhttp.h on linux

2007-10-30 Thread Paul Fisher
In using the latest 1.3e on linux, evhttp.h fails to compile because of a 
missing definition of TAILQ_ENTRY in evhttp.h.  This is due to the fact that 
the workaround in event.h is #define'd and #undef'd within event.h and not 
available to evhttp.h when defining struct evhttp_request.  This patch 
obviously fixes it:

--- libevent-1.3e/evhttp.h  2007-08-25 13:49:22.0 -0500
+++ libevent-1.3e.002/evhttp.h  2007-10-29 22:32:07.0 -0500
@@ -108,7 +108,14 @@
  * reasonable accessors.
  */
 struct evhttp_request {
+#if defined(TAILQ_ENTRY)
TAILQ_ENTRY(evhttp_request) next;
+#else
+struct {   \
+   struct type *tqe_next;  /* next element */  \
+   struct type **tqe_prev; /* address of previous next element */  \
+}   next;
+#endif
 
/* the connection object that this request belongs to */
struct evhttp_connection *evcon;

... but it would be nice if this was coordinated with the definition in 
event.h, possibly by simply not #undef'ing it from event.h.  Anyway, if there 
is a preference on how to fix this, I'd be glad to regenerate the patch.


--

paul
___
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users