mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-10 21:10:06 -04:00
whitespace fixes
This commit is contained in:
parent
de5428e7d5
commit
5c7675cc5a
6
buffer.c
6
buffer.c
@ -35,7 +35,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _EVENT_HAVE_VASPRINTF
|
#ifdef _EVENT_HAVE_VASPRINTF
|
||||||
/* If we have vasprintf, we need to define _GNU_SOURCE before we include
|
/* If we have vasprintf, we need to define _GNU_SOURCE before we include
|
||||||
* stdio.h. This comes from evconfig-private.h.
|
* stdio.h. This comes from evconfig-private.h.
|
||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
@ -191,14 +191,14 @@ evbuffer_chain_free(struct evbuffer_chain *chain)
|
|||||||
// chain is still referenced by other chains
|
// chain is still referenced by other chains
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CHAIN_PINNED(chain)) {
|
if (CHAIN_PINNED(chain)) {
|
||||||
// will get freed once no longer dangling
|
// will get freed once no longer dangling
|
||||||
chain->refcnt++;
|
chain->refcnt++;
|
||||||
chain->flags |= EVBUFFER_DANGLING;
|
chain->flags |= EVBUFFER_DANGLING;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// safe to release chain, it's either a referencing
|
// safe to release chain, it's either a referencing
|
||||||
// chain or all references to it have been freed
|
// chain or all references to it have been freed
|
||||||
if (chain->flags & EVBUFFER_REFERENCE) {
|
if (chain->flags & EVBUFFER_REFERENCE) {
|
||||||
|
@ -1618,13 +1618,13 @@ test_evbuffer_multicast(void *ptr)
|
|||||||
buf2 = evbuffer_new();
|
buf2 = evbuffer_new();
|
||||||
tt_assert(buf2);
|
tt_assert(buf2);
|
||||||
|
|
||||||
tt_int_op(evbuffer_add_buffer_reference(buf2, buf1), ==, 0);
|
tt_int_op(evbuffer_add_buffer_reference(buf2, buf1), ==, 0);
|
||||||
// nested references are not allowed
|
// nested references are not allowed
|
||||||
tt_int_op(evbuffer_add_buffer_reference(buf2, buf2), ==, -1);
|
tt_int_op(evbuffer_add_buffer_reference(buf2, buf2), ==, -1);
|
||||||
tt_int_op(evbuffer_add_buffer_reference(buf1, buf2), ==, -1);
|
tt_int_op(evbuffer_add_buffer_reference(buf1, buf2), ==, -1);
|
||||||
|
|
||||||
// both buffers contain the same amount of data
|
// both buffers contain the same amount of data
|
||||||
tt_int_op(evbuffer_get_length(buf1), ==, evbuffer_get_length(buf1));
|
tt_int_op(evbuffer_get_length(buf1), ==, evbuffer_get_length(buf1));
|
||||||
|
|
||||||
/* Make sure we can drain a little from the first buffer. */
|
/* Make sure we can drain a little from the first buffer. */
|
||||||
tt_int_op(evbuffer_remove(buf1, tmp, 6), ==, 6);
|
tt_int_op(evbuffer_remove(buf1, tmp, 6), ==, 6);
|
||||||
@ -1648,10 +1648,10 @@ test_evbuffer_multicast(void *ptr)
|
|||||||
tt_int_op(memcmp(chunk1, "If you", 6), ==, 0);
|
tt_int_op(memcmp(chunk1, "If you", 6), ==, 0);
|
||||||
evbuffer_validate(buf2);
|
evbuffer_validate(buf2);
|
||||||
|
|
||||||
/* Make sure the data can be read from the second buffer when the first is freed */
|
/* Make sure the data can be read from the second buffer when the first is freed */
|
||||||
evbuffer_free(buf1);
|
evbuffer_free(buf1);
|
||||||
buf1 = NULL;
|
buf1 = NULL;
|
||||||
|
|
||||||
tt_int_op(evbuffer_remove(buf2, tmp, 6), ==, 6);
|
tt_int_op(evbuffer_remove(buf2, tmp, 6), ==, 6);
|
||||||
tt_int_op(memcmp(tmp, "I have", 6), ==, 0);
|
tt_int_op(memcmp(tmp, "I have", 6), ==, 0);
|
||||||
|
|
||||||
@ -1686,11 +1686,11 @@ test_evbuffer_multicast_drain(void *ptr)
|
|||||||
buf2 = evbuffer_new();
|
buf2 = evbuffer_new();
|
||||||
tt_assert(buf2);
|
tt_assert(buf2);
|
||||||
|
|
||||||
tt_int_op(evbuffer_add_buffer_reference(buf2, buf1), ==, 0);
|
tt_int_op(evbuffer_add_buffer_reference(buf2, buf1), ==, 0);
|
||||||
tt_int_op(evbuffer_get_length(buf2), ==, len1+len2+2);
|
tt_int_op(evbuffer_get_length(buf2), ==, len1+len2+2);
|
||||||
tt_int_op(evbuffer_drain(buf1, evbuffer_get_length(buf1)), ==, 0);
|
tt_int_op(evbuffer_drain(buf1, evbuffer_get_length(buf1)), ==, 0);
|
||||||
tt_int_op(evbuffer_get_length(buf2), ==, len1+len2+2);
|
tt_int_op(evbuffer_get_length(buf2), ==, len1+len2+2);
|
||||||
tt_int_op(evbuffer_drain(buf2, evbuffer_get_length(buf2)), ==, 0);
|
tt_int_op(evbuffer_drain(buf2, evbuffer_get_length(buf2)), ==, 0);
|
||||||
evbuffer_validate(buf1);
|
evbuffer_validate(buf1);
|
||||||
evbuffer_validate(buf2);
|
evbuffer_validate(buf2);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user