summaryrefslogtreecommitdiff
path: root/testing/irc_syncbot.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-09-30 15:15:50 +0100
committeriphydf <iphydf@users.noreply.github.com>2016-09-30 19:06:44 +0100
commit1977d56caaff40ea9bbf6754b69bec9539a5a969 (patch)
treedb9c6d6c59dc0f91900dafe85dea1ab90f0ca8d9 /testing/irc_syncbot.c
parent949ef785a4e7aa7868c9605b6bbed15c3f4beab9 (diff)
Remove return after no-return situation (and other cleanups).
Cleanups: - Fix header guards to not use reserved names. - Avoid name shadowing. - Removed an unused variable found by avoiding name shadowing.
Diffstat (limited to 'testing/irc_syncbot.c')
-rw-r--r--testing/irc_syncbot.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/testing/irc_syncbot.c b/testing/irc_syncbot.c
index f72339a6..affc0296 100644
--- a/testing/irc_syncbot.c
+++ b/testing/irc_syncbot.c
@@ -47,9 +47,9 @@ static uint64_t get_monotime_sec(void)
47 47
48static int reconnect(void) 48static int reconnect(void)
49{ 49{
50 int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); 50 int new_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
51 51
52 if (sock < 0) { 52 if (new_sock < 0) {
53 printf("error socket\n"); 53 printf("error socket\n");
54 return -1; 54 return -1;
55 } 55 }
@@ -68,14 +68,14 @@ static int reconnect(void)
68 68
69 addr4->sin_port = htons(port); 69 addr4->sin_port = htons(port);
70 70
71 if (connect(sock, (struct sockaddr *)&addr, addrsize) != 0) { 71 if (connect(new_sock, (struct sockaddr *)&addr, addrsize) != 0) {
72 printf("error connect\n"); 72 printf("error connect\n");
73 return -1; 73 return -1;
74 } 74 }
75 75
76 send(sock, SERVER_CONNECT, sizeof(SERVER_CONNECT) - 1, MSG_NOSIGNAL); 76 send(new_sock, SERVER_CONNECT, sizeof(SERVER_CONNECT) - 1, MSG_NOSIGNAL);
77 77
78 return sock; 78 return new_sock;
79} 79}
80 80
81#include "../toxcore/tox.h" 81#include "../toxcore/tox.h"
@@ -256,9 +256,9 @@ static Tox *init_tox(int argc, char *argv[])
256 exit(1); 256 exit(1);
257 } 257 }
258 258
259 uint16_t port = atoi(argv[argvoffset + 2]); 259 uint16_t bootstrap_port = atoi(argv[argvoffset + 2]);
260 unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]); 260 unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]);
261 tox_bootstrap(tox, argv[argvoffset + 1], port, binary_string, 0); 261 tox_bootstrap(tox, argv[argvoffset + 1], bootstrap_port, binary_string, 0);
262 free(binary_string); 262 free(binary_string);
263 263
264 uint8_t *bin_id = hex_string_to_bin(temp_id); 264 uint8_t *bin_id = hex_string_to_bin(temp_id);
@@ -372,6 +372,4 @@ int main(int argc, char *argv[])
372 tox_iterate(tox, NULL); 372 tox_iterate(tox, NULL);
373 usleep(1000 * 50); 373 usleep(1000 * 50);
374 } 374 }
375
376 return 0;
377} 375}