summaryrefslogtreecommitdiff
path: root/toxcore/TCP_connection.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-09-13 22:01:45 +0100
committeriphydf <iphydf@users.noreply.github.com>2016-09-13 22:01:45 +0100
commit45d28904b92c825d1ac88be9edae8baabcd4bba1 (patch)
tree7b1b259ba09d35867c141cf072707e6a0891f97a /toxcore/TCP_connection.c
parenta8823830d39bdbde8d4f4f34bfcb26dc4bf79741 (diff)
Use <stdbool.h> and replace _Bool with bool.
This header is a requirement for the public API, therefore is assumed to exist. It is a C99 standard library header, and _Bool is not intended to be used directly, except in legacy code that defines bool (and true/false) itself. We don't use or depend on such code. None of our client code uses or depends on such code. There is no reason to not use bool.
Diffstat (limited to 'toxcore/TCP_connection.c')
-rw-r--r--toxcore/TCP_connection.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/toxcore/TCP_connection.c b/toxcore/TCP_connection.c
index 6a0b2c8a..bfd55fa0 100644
--- a/toxcore/TCP_connection.c
+++ b/toxcore/TCP_connection.c
@@ -40,7 +40,7 @@
40/* return 1 if the connections_number is not valid. 40/* return 1 if the connections_number is not valid.
41 * return 0 if the connections_number is valid. 41 * return 0 if the connections_number is valid.
42 */ 42 */
43static _Bool connections_number_not_valid(const TCP_Connections *tcp_c, int connections_number) 43static bool connections_number_not_valid(const TCP_Connections *tcp_c, int connections_number)
44{ 44{
45 if ((unsigned int)connections_number >= tcp_c->connections_length) { 45 if ((unsigned int)connections_number >= tcp_c->connections_length) {
46 return 1; 46 return 1;
@@ -60,7 +60,7 @@ static _Bool connections_number_not_valid(const TCP_Connections *tcp_c, int conn
60/* return 1 if the tcp_connections_number is not valid. 60/* return 1 if the tcp_connections_number is not valid.
61 * return 0 if the tcp_connections_number is valid. 61 * return 0 if the tcp_connections_number is valid.
62 */ 62 */
63static _Bool tcp_connections_number_not_valid(const TCP_Connections *tcp_c, int tcp_connections_number) 63static bool tcp_connections_number_not_valid(const TCP_Connections *tcp_c, int tcp_connections_number)
64{ 64{
65 if ((unsigned int)tcp_connections_number >= tcp_c->tcp_connections_length) { 65 if ((unsigned int)tcp_connections_number >= tcp_c->tcp_connections_length) {
66 return 1; 66 return 1;
@@ -228,7 +228,7 @@ int send_packet_tcp_connection(TCP_Connections *tcp_c, int connections_number, c
228 unsigned int i; 228 unsigned int i;
229 int ret = -1; 229 int ret = -1;
230 230
231 _Bool limit_reached = 0; 231 bool limit_reached = 0;
232 232
233 for (i = 0; i < MAX_FRIEND_TCP_CONNECTIONS; ++i) { 233 for (i = 0; i < MAX_FRIEND_TCP_CONNECTIONS; ++i) {
234 uint32_t tcp_con_num = con_to->connections[i].tcp_connection; 234 uint32_t tcp_con_num = con_to->connections[i].tcp_connection;
@@ -522,7 +522,7 @@ int kill_tcp_connection_to(TCP_Connections *tcp_c, int connections_number)
522 * return 0 on success. 522 * return 0 on success.
523 * return -1 on failure. 523 * return -1 on failure.
524 */ 524 */
525int set_tcp_connection_to_status(TCP_Connections *tcp_c, int connections_number, _Bool status) 525int set_tcp_connection_to_status(TCP_Connections *tcp_c, int connections_number, bool status)
526{ 526{
527 TCP_Connection_to *con_to = get_connection(tcp_c, connections_number); 527 TCP_Connection_to *con_to = get_connection(tcp_c, connections_number);
528 528
@@ -583,7 +583,7 @@ int set_tcp_connection_to_status(TCP_Connections *tcp_c, int connections_number,
583 return 0; 583 return 0;
584} 584}
585 585
586static _Bool tcp_connection_in_conn(TCP_Connection_to *con_to, unsigned int tcp_connections_number) 586static bool tcp_connection_in_conn(TCP_Connection_to *con_to, unsigned int tcp_connections_number)
587{ 587{
588 unsigned int i; 588 unsigned int i;
589 589
@@ -1253,7 +1253,7 @@ unsigned int tcp_copy_connected_relays(TCP_Connections *tcp_c, Node_format *tcp_
1253 * return 0 on success. 1253 * return 0 on success.
1254 * return -1 on failure. 1254 * return -1 on failure.
1255 */ 1255 */
1256int set_tcp_onion_status(TCP_Connections *tcp_c, _Bool status) 1256int set_tcp_onion_status(TCP_Connections *tcp_c, bool status)
1257{ 1257{
1258 if (tcp_c->onion_status == status) { 1258 if (tcp_c->onion_status == status) {
1259 return -1; 1259 return -1;