#endif
#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.
*/
#endif
// chain is still referenced by other chains
return;
}
-
+
if (CHAIN_PINNED(chain)) {
// will get freed once no longer dangling
chain->refcnt++;
chain->flags |= EVBUFFER_DANGLING;
return;
}
-
+
// safe to release chain, it's either a referencing
// chain or all references to it have been freed
if (chain->flags & EVBUFFER_REFERENCE) {
buf2 = evbuffer_new();
tt_assert(buf2);
- tt_int_op(evbuffer_add_buffer_reference(buf2, buf1), ==, 0);
- // nested references are not allowed
- 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(buf2, buf1), ==, 0);
+ // nested references are not allowed
+ tt_int_op(evbuffer_add_buffer_reference(buf2, buf2), ==, -1);
+ tt_int_op(evbuffer_add_buffer_reference(buf1, buf2), ==, -1);
- // both buffers contain the same amount of data
- tt_int_op(evbuffer_get_length(buf1), ==, evbuffer_get_length(buf1));
+ // both buffers contain the same amount of data
+ tt_int_op(evbuffer_get_length(buf1), ==, evbuffer_get_length(buf1));
/* Make sure we can drain a little from the first buffer. */
tt_int_op(evbuffer_remove(buf1, tmp, 6), ==, 6);
tt_int_op(memcmp(chunk1, "If you", 6), ==, 0);
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);
buf1 = NULL;
-
+
tt_int_op(evbuffer_remove(buf2, tmp, 6), ==, 6);
tt_int_op(memcmp(tmp, "I have", 6), ==, 0);
buf2 = evbuffer_new();
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_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_drain(buf2, evbuffer_get_length(buf2)), ==, 0);
+ tt_int_op(evbuffer_drain(buf2, evbuffer_get_length(buf2)), ==, 0);
evbuffer_validate(buf1);
evbuffer_validate(buf2);