summaryrefslogtreecommitdiff
path: root/toxcore/friend_connection.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-01-28 21:30:39 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-01-30 23:35:50 +0000
commit92ffad1a72bc8c422426d52ac408bd71242dd047 (patch)
treef592f353068dd2043525dd2cc04d6124a4ed4bc4 /toxcore/friend_connection.c
parent623e9ac331df7323660e21c8a2226523a5ee713b (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/friend_connection.c')
-rw-r--r--toxcore/friend_connection.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/toxcore/friend_connection.c b/toxcore/friend_connection.c
index 2ebc0d9b..9381262b 100644
--- a/toxcore/friend_connection.c
+++ b/toxcore/friend_connection.c
@@ -97,7 +97,7 @@ static uint8_t friendconn_id_not_valid(const Friend_Connections *fr_c, int frien
97 return 1; 97 return 1;
98 } 98 }
99 99
100 if (fr_c->conns == NULL) { 100 if (fr_c->conns == nullptr) {
101 return 1; 101 return 1;
102 } 102 }
103 103
@@ -118,13 +118,13 @@ static int realloc_friendconns(Friend_Connections *fr_c, uint32_t num)
118{ 118{
119 if (num == 0) { 119 if (num == 0) {
120 free(fr_c->conns); 120 free(fr_c->conns);
121 fr_c->conns = NULL; 121 fr_c->conns = nullptr;
122 return 0; 122 return 0;
123 } 123 }
124 124
125 Friend_Conn *newgroup_cons = (Friend_Conn *)realloc(fr_c->conns, num * sizeof(Friend_Conn)); 125 Friend_Conn *newgroup_cons = (Friend_Conn *)realloc(fr_c->conns, num * sizeof(Friend_Conn));
126 126
127 if (newgroup_cons == NULL) { 127 if (newgroup_cons == nullptr) {
128 return -1; 128 return -1;
129 } 129 }
130 130
@@ -189,7 +189,7 @@ static int wipe_friend_conn(Friend_Connections *fr_c, int friendcon_id)
189static Friend_Conn *get_conn(const Friend_Connections *fr_c, int friendcon_id) 189static Friend_Conn *get_conn(const Friend_Connections *fr_c, int friendcon_id)
190{ 190{
191 if (friendconn_id_not_valid(fr_c, friendcon_id)) { 191 if (friendconn_id_not_valid(fr_c, friendcon_id)) {
192 return 0; 192 return nullptr;
193 } 193 }
194 194
195 return &fr_c->conns[friendcon_id]; 195 return &fr_c->conns[friendcon_id];
@@ -483,7 +483,7 @@ static int handle_packet(void *object, int number, const uint8_t *data, uint16_t
483 Node_format nodes[MAX_SHARED_RELAYS]; 483 Node_format nodes[MAX_SHARED_RELAYS];
484 int n; 484 int n;
485 485
486 if ((n = unpack_nodes(nodes, MAX_SHARED_RELAYS, NULL, data + 1, length - 1, 1)) == -1) { 486 if ((n = unpack_nodes(nodes, MAX_SHARED_RELAYS, nullptr, data + 1, length - 1, 1)) == -1) {
487 return -1; 487 return -1;
488 } 488 }
489 489
@@ -873,13 +873,13 @@ int send_friend_request_packet(Friend_Connections *fr_c, int friendcon_id, uint3
873Friend_Connections *new_friend_connections(Onion_Client *onion_c, bool local_discovery_enabled) 873Friend_Connections *new_friend_connections(Onion_Client *onion_c, bool local_discovery_enabled)
874{ 874{
875 if (!onion_c) { 875 if (!onion_c) {
876 return NULL; 876 return nullptr;
877 } 877 }
878 878
879 Friend_Connections *temp = (Friend_Connections *)calloc(1, sizeof(Friend_Connections)); 879 Friend_Connections *temp = (Friend_Connections *)calloc(1, sizeof(Friend_Connections));
880 880
881 if (temp == NULL) { 881 if (temp == nullptr) {
882 return NULL; 882 return nullptr;
883 } 883 }
884 884
885 temp->dht = onion_get_dht(onion_c); 885 temp->dht = onion_get_dht(onion_c);