diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-05-15 20:23:59 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-05-15 20:23:59 +0000 |
commit | bba69e03f8101ec3efe7db69973fc93151e242ba (patch) | |
tree | 730524757910802eab0548af3299a02c41ed5eb0 /buffer.c | |
parent | b4886ec80d11a20f0b247db2378a5eea9dee1e24 (diff) | |
download | libevent-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.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -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; } |