Refactor the isc_buffer_allocate() usage using the semantic patch
The isc_buffer_allocate() function now cannot fail with ISC_R_MEMORY. This commit removes all the checks on the return code using the semantic patch from previous commit, as isc_buffer_allocate() now returns void.
This commit is contained in:
@@ -65,8 +65,7 @@ isc_buffer_reserve_test(void **state) {
|
||||
UNUSED(state);
|
||||
|
||||
b = NULL;
|
||||
result = isc_buffer_allocate(test_mctx, &b, 1024);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
isc_buffer_allocate(test_mctx, &b, 1024);
|
||||
assert_int_equal(b->length, 1024);
|
||||
|
||||
/*
|
||||
@@ -127,7 +126,6 @@ isc_buffer_reserve_test(void **state) {
|
||||
/* dynamic buffer automatic reallocation */
|
||||
static void
|
||||
isc_buffer_dynamic_test(void **state) {
|
||||
isc_result_t result;
|
||||
isc_buffer_t *b;
|
||||
size_t last_length = 10;
|
||||
int i;
|
||||
@@ -135,8 +133,7 @@ isc_buffer_dynamic_test(void **state) {
|
||||
UNUSED(state);
|
||||
|
||||
b = NULL;
|
||||
result = isc_buffer_allocate(test_mctx, &b, last_length);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
isc_buffer_allocate(test_mctx, &b, last_length);
|
||||
assert_non_null(b);
|
||||
assert_int_equal(b->length, last_length);
|
||||
|
||||
@@ -194,8 +191,7 @@ isc_buffer_copyregion_test(void **state) {
|
||||
|
||||
UNUSED(state);
|
||||
|
||||
result = isc_buffer_allocate(test_mctx, &b, sizeof(data));
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
isc_buffer_allocate(test_mctx, &b, sizeof(data));
|
||||
|
||||
/*
|
||||
* Fill originally allocated buffer space.
|
||||
@@ -234,8 +230,7 @@ isc_buffer_printf_test(void **state) {
|
||||
* Prepare a buffer with auto-reallocation enabled.
|
||||
*/
|
||||
b = NULL;
|
||||
result = isc_buffer_allocate(test_mctx, &b, 0);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
isc_buffer_allocate(test_mctx, &b, 0);
|
||||
isc_buffer_setautorealloc(b, true);
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user