summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-05-15 20:23:59 +0000
committerNick Mathewson <nickm@torproject.org>2009-05-15 20:23:59 +0000
commitbba69e03f8101ec3efe7db69973fc93151e242ba (patch)
tree730524757910802eab0548af3299a02c41ed5eb0 /buffer.c
parentb4886ec80d11a20f0b247db2378a5eea9dee1e24 (diff)
downloadlibevent-bba69e03f8101ec3efe7db69973fc93151e242ba.tar.gz
New semantics for evbuffer_cb_set_flags().
Previously, set_flags() would replace all previous user-visible flags. Now it just sets the flags, and there is a clear_flags() function to clear other flags. svn:r1293
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/buffer.c b/buffer.c
index 18ee1149..b2f16c3c 100644
--- a/buffer.c
+++ b/buffer.c
@@ -2253,8 +2253,22 @@ int
evbuffer_cb_set_flags(struct evbuffer *buffer,
struct evbuffer_cb_entry *cb, ev_uint32_t flags)
{
+ /* the user isn't allowed to mess with these. */
+ flags &= ~EVBUFFER_CB_INTERNAL_FLAGS;
EVBUFFER_LOCK(buffer, EVTHREAD_WRITE);
- cb->flags = (cb->flags & EVBUFFER_CB_INTERNAL_FLAGS) | flags;
+ cb->flags |= flags;
+ EVBUFFER_UNLOCK(buffer, EVTHREAD_WRITE);
+ return 0;
+}
+
+int
+evbuffer_cb_clear_flags(struct evbuffer *buffer,
+ struct evbuffer_cb_entry *cb, ev_uint32_t flags)
+{
+ /* the user isn't allowed to mess with these. */
+ flags &= ~EVBUFFER_CB_INTERNAL_FLAGS;
+ EVBUFFER_LOCK(buffer, EVTHREAD_WRITE);
+ cb->flags &= ~flags;
EVBUFFER_UNLOCK(buffer, EVTHREAD_WRITE);
return 0;
}