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

Replace custom isc_boolean_t with C standard bool type

This commit is contained in:
Ondřej Surý
2018-04-17 08:29:14 -07:00
parent cb6a185c69
commit 994e656977
546 changed files with 10785 additions and 10367 deletions

View File

@@ -15,6 +15,7 @@
#include <atf-c.h>
#include <stdbool.h>
#include <unistd.h>
#include <time.h>
@@ -26,23 +27,23 @@
#include "../unix/socket_p.h"
#include "isctest.h"
static isc_boolean_t recv_dscp;
static bool recv_dscp;
static unsigned int recv_dscp_value;
static isc_boolean_t recv_trunc;
static bool recv_trunc;
/*
* Helper functions
*/
typedef struct {
isc_boolean_t done;
bool done;
isc_result_t result;
isc_socket_t *socket;
} completion_t;
static void
completion_init(completion_t *completion) {
completion->done = ISC_FALSE;
completion->done = false;
completion->socket = NULL;
}
@@ -54,7 +55,7 @@ accept_done(isc_task_t *task, isc_event_t *event) {
UNUSED(task);
completion->result = nevent->result;
completion->done = ISC_TRUE;
completion->done = true;
if (completion->result == ISC_R_SUCCESS)
completion->socket = nevent->newsocket;
@@ -70,14 +71,14 @@ event_done(isc_task_t *task, isc_event_t *event) {
dev = (isc_socketevent_t *) event;
completion->result = dev->result;
completion->done = ISC_TRUE;
completion->done = true;
if ((dev->attributes & ISC_SOCKEVENTATTR_DSCP) != 0) {
recv_dscp = ISC_TRUE;
recv_dscp = true;
recv_dscp_value = dev->dscp;;
} else {
recv_dscp = ISC_FALSE;
recv_dscp = false;
}
recv_trunc = ISC_TF((dev->attributes & ISC_SOCKEVENTATTR_TRUNC) != 0);
recv_trunc = (dev->attributes & ISC_SOCKEVENTATTR_TRUNC);
isc_event_free(&event);
}
@@ -160,7 +161,7 @@ ATF_TC_BODY(udp_sendto, tc) {
UNUSED(tc);
result = isc_test_begin(NULL, ISC_TRUE, 0);
result = isc_test_begin(NULL, true, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
in.s_addr = inet_addr("127.0.0.1");
@@ -235,7 +236,7 @@ ATF_TC_BODY(udp_dup, tc) {
UNUSED(tc);
result = isc_test_begin(NULL, ISC_TRUE, 0);
result = isc_test_begin(NULL, true, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
in.s_addr = inet_addr("127.0.0.1");
@@ -337,7 +338,7 @@ ATF_TC_BODY(udp_dscp_v4, tc) {
UNUSED(tc);
result = isc_test_begin(NULL, ISC_TRUE, 0);
result = isc_test_begin(NULL, true, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
in.s_addr = inet_addr("127.0.0.1");
@@ -389,7 +390,7 @@ ATF_TC_BODY(udp_dscp_v4, tc) {
socketevent->attributes &= ~ISC_SOCKEVENTATTR_DSCP;
}
recv_dscp = ISC_FALSE;
recv_dscp = false;
recv_dscp_value = 0;
result = isc_socket_sendto2(s1, &r, task, &addr2, NULL, socketevent, 0);
@@ -442,7 +443,7 @@ ATF_TC_BODY(udp_dscp_v6, tc) {
UNUSED(tc);
result = isc_test_begin(NULL, ISC_TRUE, 0);
result = isc_test_begin(NULL, true, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
n = inet_pton(AF_INET6, "::1", &in6.s6_addr);
@@ -494,7 +495,7 @@ ATF_TC_BODY(udp_dscp_v6, tc) {
} else if ((isc_net_probedscp() & ISC_NET_DSCPSETV6) != 0)
isc_socket_dscp(s1, 056); /* EF */
recv_dscp = ISC_FALSE;
recv_dscp = false;
recv_dscp_value = 0;
result = isc_socket_sendto2(s1, &r, task, &addr2, NULL, socketevent, 0);
@@ -547,7 +548,7 @@ ATF_TC_BODY(tcp_dscp_v4, tc) {
UNUSED(tc);
result = isc_test_begin(NULL, ISC_TRUE, 0);
result = isc_test_begin(NULL, true, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
in.s_addr = inet_addr("127.0.0.1");
@@ -592,7 +593,7 @@ ATF_TC_BODY(tcp_dscp_v4, tc) {
r.base = (void *) sendbuf;
r.length = strlen(sendbuf) + 1;
recv_dscp = ISC_FALSE;
recv_dscp = false;
recv_dscp_value = 0;
completion_init(&completion);
@@ -647,7 +648,7 @@ ATF_TC_BODY(tcp_dscp_v6, tc) {
UNUSED(tc);
result = isc_test_begin(NULL, ISC_TRUE, 0);
result = isc_test_begin(NULL, true, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
n = inet_pton(AF_INET6, "::1", &in6.s6_addr);
@@ -695,7 +696,7 @@ ATF_TC_BODY(tcp_dscp_v6, tc) {
r.base = (void *) sendbuf;
r.length = strlen(sendbuf) + 1;
recv_dscp = ISC_FALSE;
recv_dscp = false;
recv_dscp_value = 0;
completion_init(&completion);
@@ -798,7 +799,7 @@ ATF_TC_BODY(udp_trunc, tc) {
UNUSED(tc);
result = isc_test_begin(NULL, ISC_TRUE, 0);
result = isc_test_begin(NULL, true, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
in.s_addr = inet_addr("127.0.0.1");
@@ -855,14 +856,14 @@ ATF_TC_BODY(udp_trunc, tc) {
r.base = (void *) recvbuf;
r.length = BUFSIZ;
completion_init(&completion);
recv_trunc = ISC_FALSE;
recv_trunc = false;
result = isc_socket_recv(s2, &r, 1, task, event_done, &completion);
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
waitfor(&completion);
ATF_CHECK(completion.done);
ATF_CHECK_EQ(completion.result, ISC_R_SUCCESS);
ATF_CHECK_STREQ(recvbuf, "Hello");
ATF_CHECK_EQ(recv_trunc, ISC_FALSE);
ATF_CHECK_EQ(recv_trunc, false);
/*
* Send a message that will be truncated.
@@ -888,14 +889,14 @@ ATF_TC_BODY(udp_trunc, tc) {
r.base = (void *) recvbuf;
r.length = BUFSIZ;
completion_init(&completion);
recv_trunc = ISC_FALSE;
recv_trunc = false;
result = isc_socket_recv(s2, &r, 1, task, event_done, &completion);
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
waitfor(&completion);
ATF_CHECK(completion.done);
ATF_CHECK_EQ(completion.result, ISC_R_SUCCESS);
ATF_CHECK_STREQ(recvbuf, "Hello");
ATF_CHECK_EQ(recv_trunc, ISC_TRUE);
ATF_CHECK_EQ(recv_trunc, true);
isc_task_detach(&task);