2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Enable auto-reallocation for all isc_buffer_allocate() buffers

When isc_buffer_t buffer is created with isc_buffer_allocate() assume
that we want it to always auto-reallocate instead of having an extra
call to enable auto-reallocation.
This commit is contained in:
Ondřej Surý
2022-12-15 22:27:12 +01:00
parent 135ec7a0f0
commit 6bd2b34180
6 changed files with 30 additions and 57 deletions

View File

@@ -113,8 +113,6 @@ ISC_RUN_TEST_IMPL(isc_buffer_dynamic) {
assert_non_null(b);
assert_int_equal(b->length, last_length);
isc_buffer_setautorealloc(b, true);
isc_buffer_putuint8(b, 1);
for (i = 0; i < 1000; i++) {
@@ -166,16 +164,9 @@ ISC_RUN_TEST_IMPL(isc_buffer_copyregion) {
assert_int_equal(result, ISC_R_SUCCESS);
/*
* Appending more data to the buffer should fail.
* Appending should succeed.
*/
result = isc_buffer_copyregion(b, &r);
assert_int_equal(result, ISC_R_NOSPACE);
/*
* Enable auto reallocation and retry. Appending should now succeed.
*/
isc_buffer_setautorealloc(b, true);
result = isc_buffer_copyregion(b, &r);
assert_int_equal(result, ISC_R_SUCCESS);
isc_buffer_free(&b);
@@ -196,7 +187,6 @@ ISC_RUN_TEST_IMPL(isc_buffer_printf) {
*/
b = NULL;
isc_buffer_allocate(mctx, &b, 0);
isc_buffer_setautorealloc(b, true);
/*
* Sanity check.