93c093c24e
buffers. This is a new dependency of an upcoming update of audio/umurmur. Tested by Jonathon Sisson, who also takes maintainership OK ajacoutot@
73 lines
2.1 KiB
Plaintext
73 lines
2.1 KiB
Plaintext
$OpenBSD: patch-src_google_protobuf-c_protobuf-c-dispatch_c,v 1.1.1.1 2011/07/08 08:58:02 dcoppa Exp $
|
|
|
|
malloc.h is obsolete
|
|
|
|
clear_changes isn't necessary because n_changes is cleared in
|
|
dispatch_dispatch (upstream svn revision r286)
|
|
|
|
--- src/google/protobuf-c/protobuf-c-dispatch.c.orig Thu Mar 10 20:02:48 2011
|
|
+++ src/google/protobuf-c/protobuf-c-dispatch.c Thu Jul 7 12:50:09 2011
|
|
@@ -10,11 +10,7 @@
|
|
#include "protobuf-c-config.h"
|
|
#endif
|
|
#include <assert.h>
|
|
-#if HAVE_ALLOCA_H
|
|
-# include <alloca.h>
|
|
-#elif HAVE_MALLOC_H
|
|
-# include <malloc.h>
|
|
-#endif
|
|
+#include <stdlib.h>
|
|
#include <sys/time.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
@@ -98,6 +94,7 @@ struct _RealDispatch
|
|
FDMapNode *fd_map_tree; /* map indexed by fd */
|
|
#endif
|
|
|
|
+ protobuf_c_boolean is_dispatching;
|
|
|
|
ProtobufCDispatchTimer *timer_tree;
|
|
ProtobufCAllocator *allocator;
|
|
@@ -193,8 +190,10 @@ ProtobufCDispatch *protobuf_c_dispatch_new (ProtobufCA
|
|
rv->allocator = allocator;
|
|
rv->timer_tree = NULL;
|
|
rv->first_idle = rv->last_idle = NULL;
|
|
+ rv->base.has_idle = 0;
|
|
rv->recycled_idles = NULL;
|
|
rv->recycled_timeouts = NULL;
|
|
+ rv->is_dispatching = 0;
|
|
|
|
/* need to handle SIGPIPE more gracefully than default */
|
|
signal (SIGPIPE, SIG_IGN);
|
|
@@ -531,6 +530,12 @@ protobuf_c_dispatch_dispatch (ProtobufCDispatch *dispa
|
|
unsigned i;
|
|
FDMap *fd_map = d->fd_map;
|
|
struct timeval tv;
|
|
+
|
|
+ /* Re-entrancy guard. If this is triggerred, then
|
|
+ you are calling protobuf_c_dispatch_dispatch (or _run)
|
|
+ from a callback function. That's not allowed. */
|
|
+ d->is_dispatching = 1;
|
|
+
|
|
fd_max = 0;
|
|
for (i = 0; i < n_notifies; i++)
|
|
if (fd_max < (unsigned) notifies[i].fd)
|
|
@@ -604,6 +609,9 @@ protobuf_c_dispatch_dispatch (ProtobufCDispatch *dispa
|
|
}
|
|
if (d->timer_tree == NULL)
|
|
d->base.has_timeout = 0;
|
|
+
|
|
+ /* Finish reentrance guard. */
|
|
+ d->is_dispatching = 0;
|
|
}
|
|
|
|
void
|
|
@@ -717,7 +725,6 @@ protobuf_c_dispatch_run (ProtobufCDispatch *dispatch)
|
|
if (events[n_events].events != 0)
|
|
n_events++;
|
|
}
|
|
- protobuf_c_dispatch_clear_changes (dispatch);
|
|
protobuf_c_dispatch_dispatch (dispatch, n_events, events);
|
|
if (to_free)
|
|
FREE (to_free);
|