diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-01-28 21:30:39 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-01-30 23:35:50 +0000 |
commit | 92ffad1a72bc8c422426d52ac408bd71242dd047 (patch) | |
tree | f592f353068dd2043525dd2cc04d6124a4ed4bc4 /toxcore/TCP_connection.c | |
parent | 623e9ac331df7323660e21c8a2226523a5ee713b (diff) |
Use nullptr as NULL pointer constant instead of NULL or 0.
This changes only code, no string literals or comments.
Diffstat (limited to 'toxcore/TCP_connection.c')
-rw-r--r-- | toxcore/TCP_connection.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/toxcore/TCP_connection.c b/toxcore/TCP_connection.c index a43069da..3ce75948 100644 --- a/toxcore/TCP_connection.c +++ b/toxcore/TCP_connection.c | |||
@@ -78,7 +78,7 @@ const uint8_t *tcp_connections_public_key(const TCP_Connections *tcp_c) | |||
78 | array, \ | 78 | array, \ |
79 | (num) * sizeof(element_type)), \ | 79 | (num) * sizeof(element_type)), \ |
80 | temp_pointer ? (array = temp_pointer, 0) : -1) \ | 80 | temp_pointer ? (array = temp_pointer, 0) : -1) \ |
81 | : (free(array), array = NULL, 0)) | 81 | : (free(array), array = nullptr, 0)) |
82 | 82 | ||
83 | 83 | ||
84 | /* return 1 if the connections_number is not valid. | 84 | /* return 1 if the connections_number is not valid. |
@@ -90,7 +90,7 @@ static bool connections_number_not_valid(const TCP_Connections *tcp_c, int conne | |||
90 | return 1; | 90 | return 1; |
91 | } | 91 | } |
92 | 92 | ||
93 | if (tcp_c->connections == NULL) { | 93 | if (tcp_c->connections == nullptr) { |
94 | return 1; | 94 | return 1; |
95 | } | 95 | } |
96 | 96 | ||
@@ -110,7 +110,7 @@ static bool tcp_connections_number_not_valid(const TCP_Connections *tcp_c, int t | |||
110 | return 1; | 110 | return 1; |
111 | } | 111 | } |
112 | 112 | ||
113 | if (tcp_c->tcp_connections == NULL) { | 113 | if (tcp_c->tcp_connections == nullptr) { |
114 | return 1; | 114 | return 1; |
115 | } | 115 | } |
116 | 116 | ||
@@ -239,7 +239,7 @@ static int wipe_tcp_connection(TCP_Connections *tcp_c, int tcp_connections_numbe | |||
239 | static TCP_Connection_to *get_connection(const TCP_Connections *tcp_c, int connections_number) | 239 | static TCP_Connection_to *get_connection(const TCP_Connections *tcp_c, int connections_number) |
240 | { | 240 | { |
241 | if (connections_number_not_valid(tcp_c, connections_number)) { | 241 | if (connections_number_not_valid(tcp_c, connections_number)) { |
242 | return 0; | 242 | return nullptr; |
243 | } | 243 | } |
244 | 244 | ||
245 | return &tcp_c->connections[connections_number]; | 245 | return &tcp_c->connections[connections_number]; |
@@ -248,7 +248,7 @@ static TCP_Connection_to *get_connection(const TCP_Connections *tcp_c, int conne | |||
248 | static TCP_con *get_tcp_connection(const TCP_Connections *tcp_c, int tcp_connections_number) | 248 | static TCP_con *get_tcp_connection(const TCP_Connections *tcp_c, int tcp_connections_number) |
249 | { | 249 | { |
250 | if (tcp_connections_number_not_valid(tcp_c, tcp_connections_number)) { | 250 | if (tcp_connections_number_not_valid(tcp_c, tcp_connections_number)) { |
251 | return 0; | 251 | return nullptr; |
252 | } | 252 | } |
253 | 253 | ||
254 | return &tcp_c->tcp_connections[tcp_connections_number]; | 254 | return &tcp_c->tcp_connections[tcp_connections_number]; |
@@ -824,7 +824,7 @@ static int sleep_tcp_relay_connection(TCP_Connections *tcp_c, int tcp_connection | |||
824 | memcpy(tcp_con->relay_pk, tcp_con_public_key(tcp_con->connection), CRYPTO_PUBLIC_KEY_SIZE); | 824 | memcpy(tcp_con->relay_pk, tcp_con_public_key(tcp_con->connection), CRYPTO_PUBLIC_KEY_SIZE); |
825 | 825 | ||
826 | kill_TCP_connection(tcp_con->connection); | 826 | kill_TCP_connection(tcp_con->connection); |
827 | tcp_con->connection = NULL; | 827 | tcp_con->connection = nullptr; |
828 | 828 | ||
829 | unsigned int i; | 829 | unsigned int i; |
830 | 830 | ||
@@ -922,7 +922,7 @@ static int tcp_response_callback(void *object, uint8_t connection_id, const uint | |||
922 | 922 | ||
923 | TCP_Connection_to *con_to = get_connection(tcp_c, connections_number); | 923 | TCP_Connection_to *con_to = get_connection(tcp_c, connections_number); |
924 | 924 | ||
925 | if (con_to == NULL) { | 925 | if (con_to == nullptr) { |
926 | return -1; | 926 | return -1; |
927 | } | 927 | } |
928 | 928 | ||
@@ -1368,14 +1368,14 @@ int set_tcp_onion_status(TCP_Connections *tcp_c, bool status) | |||
1368 | */ | 1368 | */ |
1369 | TCP_Connections *new_tcp_connections(const uint8_t *secret_key, TCP_Proxy_Info *proxy_info) | 1369 | TCP_Connections *new_tcp_connections(const uint8_t *secret_key, TCP_Proxy_Info *proxy_info) |
1370 | { | 1370 | { |
1371 | if (secret_key == NULL) { | 1371 | if (secret_key == nullptr) { |
1372 | return NULL; | 1372 | return nullptr; |
1373 | } | 1373 | } |
1374 | 1374 | ||
1375 | TCP_Connections *temp = (TCP_Connections *)calloc(1, sizeof(TCP_Connections)); | 1375 | TCP_Connections *temp = (TCP_Connections *)calloc(1, sizeof(TCP_Connections)); |
1376 | 1376 | ||
1377 | if (temp == NULL) { | 1377 | if (temp == nullptr) { |
1378 | return NULL; | 1378 | return nullptr; |
1379 | } | 1379 | } |
1380 | 1380 | ||
1381 | memcpy(temp->self_secret_key, secret_key, CRYPTO_SECRET_KEY_SIZE); | 1381 | memcpy(temp->self_secret_key, secret_key, CRYPTO_SECRET_KEY_SIZE); |
@@ -1400,7 +1400,7 @@ static void do_tcp_conns(TCP_Connections *tcp_c, void *userdata) | |||
1400 | tcp_con = get_tcp_connection(tcp_c, i); | 1400 | tcp_con = get_tcp_connection(tcp_c, i); |
1401 | 1401 | ||
1402 | // Make sure the TCP connection wasn't dropped in any of the callbacks. | 1402 | // Make sure the TCP connection wasn't dropped in any of the callbacks. |
1403 | assert(tcp_con != NULL); | 1403 | assert(tcp_con != nullptr); |
1404 | 1404 | ||
1405 | if (tcp_con_status(tcp_con->connection) == TCP_CLIENT_DISCONNECTED) { | 1405 | if (tcp_con_status(tcp_con->connection) == TCP_CLIENT_DISCONNECTED) { |
1406 | if (tcp_con->status == TCP_CONN_CONNECTED) { | 1406 | if (tcp_con->status == TCP_CONN_CONNECTED) { |