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_client.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_client.c')
-rw-r--r-- | toxcore/TCP_client.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/toxcore/TCP_client.c b/toxcore/TCP_client.c index b4092f80..c3d6f63d 100644 --- a/toxcore/TCP_client.c +++ b/toxcore/TCP_client.c | |||
@@ -382,7 +382,7 @@ static int client_send_pending_data(TCP_Client_Connection *con) | |||
382 | con->priority_queue_start = p; | 382 | con->priority_queue_start = p; |
383 | 383 | ||
384 | if (!p) { | 384 | if (!p) { |
385 | con->priority_queue_end = NULL; | 385 | con->priority_queue_end = nullptr; |
386 | return 0; | 386 | return 0; |
387 | } | 387 | } |
388 | 388 | ||
@@ -401,7 +401,7 @@ static bool client_add_priority(TCP_Client_Connection *con, const uint8_t *packe | |||
401 | return 0; | 401 | return 0; |
402 | } | 402 | } |
403 | 403 | ||
404 | new_list->next = NULL; | 404 | new_list->next = nullptr; |
405 | new_list->size = size; | 405 | new_list->size = size; |
406 | new_list->sent = sent; | 406 | new_list->sent = sent; |
407 | memcpy(new_list->data, packet, size); | 407 | memcpy(new_list->data, packet, size); |
@@ -694,16 +694,16 @@ TCP_Client_Connection *new_TCP_connection(IP_Port ip_port, const uint8_t *public | |||
694 | const uint8_t *self_secret_key, TCP_Proxy_Info *proxy_info) | 694 | const uint8_t *self_secret_key, TCP_Proxy_Info *proxy_info) |
695 | { | 695 | { |
696 | if (networking_at_startup() != 0) { | 696 | if (networking_at_startup() != 0) { |
697 | return NULL; | 697 | return nullptr; |
698 | } | 698 | } |
699 | 699 | ||
700 | if (ip_port.ip.family != TOX_AF_INET && ip_port.ip.family != TOX_AF_INET6) { | 700 | if (ip_port.ip.family != TOX_AF_INET && ip_port.ip.family != TOX_AF_INET6) { |
701 | return NULL; | 701 | return nullptr; |
702 | } | 702 | } |
703 | 703 | ||
704 | TCP_Proxy_Info default_proxyinfo; | 704 | TCP_Proxy_Info default_proxyinfo; |
705 | 705 | ||
706 | if (proxy_info == NULL) { | 706 | if (proxy_info == nullptr) { |
707 | default_proxyinfo.proxy_type = TCP_PROXY_NONE; | 707 | default_proxyinfo.proxy_type = TCP_PROXY_NONE; |
708 | proxy_info = &default_proxyinfo; | 708 | proxy_info = &default_proxyinfo; |
709 | } | 709 | } |
@@ -717,24 +717,24 @@ TCP_Client_Connection *new_TCP_connection(IP_Port ip_port, const uint8_t *public | |||
717 | Socket sock = net_socket(family, TOX_SOCK_STREAM, TOX_PROTO_TCP); | 717 | Socket sock = net_socket(family, TOX_SOCK_STREAM, TOX_PROTO_TCP); |
718 | 718 | ||
719 | if (!sock_valid(sock)) { | 719 | if (!sock_valid(sock)) { |
720 | return NULL; | 720 | return nullptr; |
721 | } | 721 | } |
722 | 722 | ||
723 | if (!set_socket_nosigpipe(sock)) { | 723 | if (!set_socket_nosigpipe(sock)) { |
724 | kill_sock(sock); | 724 | kill_sock(sock); |
725 | return 0; | 725 | return nullptr; |
726 | } | 726 | } |
727 | 727 | ||
728 | if (!(set_socket_nonblock(sock) && connect_sock_to(sock, ip_port, proxy_info))) { | 728 | if (!(set_socket_nonblock(sock) && connect_sock_to(sock, ip_port, proxy_info))) { |
729 | kill_sock(sock); | 729 | kill_sock(sock); |
730 | return NULL; | 730 | return nullptr; |
731 | } | 731 | } |
732 | 732 | ||
733 | TCP_Client_Connection *temp = (TCP_Client_Connection *)calloc(sizeof(TCP_Client_Connection), 1); | 733 | TCP_Client_Connection *temp = (TCP_Client_Connection *)calloc(sizeof(TCP_Client_Connection), 1); |
734 | 734 | ||
735 | if (temp == NULL) { | 735 | if (temp == nullptr) { |
736 | kill_sock(sock); | 736 | kill_sock(sock); |
737 | return NULL; | 737 | return nullptr; |
738 | } | 738 | } |
739 | 739 | ||
740 | temp->sock = sock; | 740 | temp->sock = sock; |
@@ -761,7 +761,7 @@ TCP_Client_Connection *new_TCP_connection(IP_Port ip_port, const uint8_t *public | |||
761 | if (generate_handshake(temp) == -1) { | 761 | if (generate_handshake(temp) == -1) { |
762 | kill_sock(sock); | 762 | kill_sock(sock); |
763 | free(temp); | 763 | free(temp); |
764 | return NULL; | 764 | return nullptr; |
765 | } | 765 | } |
766 | 766 | ||
767 | break; | 767 | break; |
@@ -1062,7 +1062,7 @@ void do_TCP_connection(TCP_Client_Connection *TCP_connection, void *userdata) | |||
1062 | */ | 1062 | */ |
1063 | void kill_TCP_connection(TCP_Client_Connection *TCP_connection) | 1063 | void kill_TCP_connection(TCP_Client_Connection *TCP_connection) |
1064 | { | 1064 | { |
1065 | if (TCP_connection == NULL) { | 1065 | if (TCP_connection == nullptr) { |
1066 | return; | 1066 | return; |
1067 | } | 1067 | } |
1068 | 1068 | ||