Skip to content

Commit cfb0aa8

Browse files
committed
cleanup: Remove extra parens around function arguments.
1 parent c1b32bd commit cfb0aa8

File tree

8 files changed

+19
-16
lines changed

8 files changed

+19
-16
lines changed

other/analysis/gen-file.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,30 @@ put() {
2929
}
3030

3131
putmain() {
32-
echo "namespace ${1//[^a-zA-Z0-9_]/_} {" >>amalgamation.cc
32+
NS=$(echo "${1//[^a-zA-Z0-9_]/_}" | sed -e 's/^__*//')
33+
echo "namespace $NS {" >>amalgamation.cc
3334
if [ "$SKIP_LINES" = "" ]; then
3435
echo "#line 1 \"$1\"" >>amalgamation.cc
3536
fi
3637
sed -e 's/^int main(/static &/' "$1" >>amalgamation.cc
37-
echo "} // namespace ${1//[^a-zA-Z0-9_]/_}" >>amalgamation.cc
38+
echo "} // namespace $NS" >>amalgamation.cc
3839
}
3940

4041
callmain() {
41-
echo " call(${1//[^a-zA-Z0-9_]/_}::main, argc, argv);" >>amalgamation.cc
42+
NS=$(echo "${1//[^a-zA-Z0-9_]/_}" | sed -e 's/^__*//')
43+
echo " call($NS::main, argc, argv);" >>amalgamation.cc
4244
}
4345

4446
: >amalgamation.cc
4547

46-
put auto_tests/check_compat.h
47-
4848
# Include all C and C++ code
4949
FIND_QUERY="find . '-(' -name '*.c' -or -name '*.cc' '-)'"
5050
# Excludes
5151
FIND_QUERY="$FIND_QUERY -and -not -wholename './_build/*'"
5252
FIND_QUERY="$FIND_QUERY -and -not -wholename './super_donators/*'"
5353
FIND_QUERY="$FIND_QUERY -and -not -name amalgamation.cc"
5454
FIND_QUERY="$FIND_QUERY -and -not -name av_test.c"
55+
FIND_QUERY="$FIND_QUERY -and -not -name cracker.c"
5556
FIND_QUERY="$FIND_QUERY -and -not -name dht_test.c"
5657
FIND_QUERY="$FIND_QUERY -and -not -name trace.cc"
5758
FIND_QUERY="$FIND_QUERY -and -not -name version_test.c"
@@ -64,6 +65,8 @@ readarray -t FILES <<<"$(eval "$FIND_QUERY")"
6465
grep -E -v '<win|<ws|<iphlp|<libc|<mach/|<crypto_|<randombytes|<u.h>|<sys/filio|<stropts.h>|<linux'
6566
done) | sort -u >>amalgamation.cc
6667

68+
put auto_tests/check_compat.h
69+
6770
echo 'namespace {' >>amalgamation.cc
6871
for i in "${FILES[@]}"; do
6972
if ! grep -q '^int main(' "$i"; then

toxav/bwcontroller.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ static void send_update(BWController *bwc)
136136
if (bwc->cycle.lost) {
137137
LOGGER_DEBUG(bwc->m->log, "%p Sent update rcv: %u lost: %u percent: %f %%",
138138
(void *)bwc, bwc->cycle.recv, bwc->cycle.lost,
139-
(((double) bwc->cycle.lost / (bwc->cycle.recv + bwc->cycle.lost)) * 100.0));
139+
((double)bwc->cycle.lost / (bwc->cycle.recv + bwc->cycle.lost)) * 100.0);
140140
uint8_t bwc_packet[sizeof(struct BWCMessage) + 1];
141141
size_t offset = 0;
142142

@@ -178,9 +178,9 @@ static int on_update(BWController *bwc, const struct BWCMessage *msg)
178178

179179
if (lost && bwc->mcb) {
180180
LOGGER_DEBUG(bwc->m->log, "recved: %u lost: %u percentage: %f %%", recv, lost,
181-
(((double) lost / (recv + lost)) * 100.0));
181+
((double)lost / (recv + lost)) * 100.0);
182182
bwc->mcb(bwc, bwc->friend_number,
183-
((float) lost / (recv + lost)),
183+
(float)lost / (recv + lost),
184184
bwc->mcb_user_data);
185185
}
186186

toxav/rtp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ static void update_bwc_values(const Logger *log, RTPSession *session, const stru
320320

321321
if (received_length_full < data_length_full) {
322322
LOGGER_DEBUG(log, "BWC: full length=%u received length=%d", data_length_full, received_length_full);
323-
bwc_add_lost(session->bwc, (data_length_full - received_length_full));
323+
bwc_add_lost(session->bwc, data_length_full - received_length_full);
324324
}
325325
}
326326
}
@@ -479,7 +479,7 @@ static int handle_rtp_packet(Messenger *m, uint32_t friendnumber, const uint8_t
479479
return -1;
480480
}
481481

482-
LOGGER_DEBUG(m->log, "header.pt %d, video %d", (uint8_t)header.pt, (RTP_TYPE_VIDEO % 128));
482+
LOGGER_DEBUG(m->log, "header.pt %d, video %d", (uint8_t)header.pt, RTP_TYPE_VIDEO % 128);
483483

484484
// The sender uses the new large-frame capable protocol and is sending a
485485
// video packet.

toxcore/friend_connection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ void do_friend_connections(Friend_Connections *fr_c, void *userdata)
932932
if (friend_con->dht_lock) {
933933
if (friend_new_connection(fr_c, i) == 0) {
934934
set_direct_ip_port(fr_c->net_crypto, friend_con->crypt_connection_id, friend_con->dht_ip_port, 0);
935-
connect_to_saved_tcp_relays(fr_c, i, (MAX_FRIEND_TCP_CONNECTIONS / 2)); /* Only fill it half up. */
935+
connect_to_saved_tcp_relays(fr_c, i, MAX_FRIEND_TCP_CONNECTIONS / 2); /* Only fill it half up. */
936936
}
937937
}
938938
} else if (friend_con->status == FRIENDCONN_STATUS_CONNECTED) {

toxcore/group.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2202,7 +2202,7 @@ static unsigned int send_peers(Group_Chats *g_c, const Group_c *g, int friendcon
22022202
|| (p - response_packet) + sizeof(uint16_t) + CRYPTO_PUBLIC_KEY_SIZE * 2 + 1 + g->group[i].nick_len >
22032203
sizeof(response_packet)) {
22042204
if (send_packet_group_peer(g_c->fr_c, friendcon_id, PACKET_ID_DIRECT_CONFERENCE, group_num, response_packet,
2205-
(p - response_packet))) {
2205+
p - response_packet)) {
22062206
sent = i;
22072207
} else {
22082208
return sent;

toxcore/network.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,12 +499,12 @@ static void loglogdata(const Logger *log, const char *message, const uint8_t *bu
499499
net_kill_strerror(strerror);
500500
} else if ((res > 0) && ((size_t)res <= buflen)) {
501501
LOGGER_TRACE(log, "[%2u] %s %3u%c %s:%u (%u: %s) | %04x%04x",
502-
buffer[0], message, min_u16(res, 999), ((size_t)res < buflen ? '<' : '='),
502+
buffer[0], message, min_u16(res, 999), (size_t)res < buflen ? '<' : '=',
503503
ip_ntoa(&ip_port.ip, ip_str, sizeof(ip_str)), net_ntohs(ip_port.port), 0, "OK",
504504
data_0(buflen, buffer), data_1(buflen, buffer));
505505
} else { /* empty or overwrite */
506506
LOGGER_TRACE(log, "[%2u] %s %u%c%u %s:%u (%u: %s) | %04x%04x",
507-
buffer[0], message, res, (!res ? '!' : '>'), buflen,
507+
buffer[0], message, res, !res ? '!' : '>', buflen,
508508
ip_ntoa(&ip_port.ip, ip_str, sizeof(ip_str)), net_ntohs(ip_port.port), 0, "OK",
509509
data_0(buflen, buffer), data_1(buflen, buffer));
510510
}

toxcore/onion_client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ static int send_dhtpk_announce(Onion_Client *onion_c, uint16_t friend_num, uint8
11821182
net_pack_u64(data + 1, no_replay);
11831183
memcpy(data + 1 + sizeof(uint64_t), dht_get_self_public_key(onion_c->dht), CRYPTO_PUBLIC_KEY_SIZE);
11841184
Node_format nodes[MAX_SENT_NODES];
1185-
uint16_t num_relays = copy_connected_tcp_relays(onion_c->c, nodes, (MAX_SENT_NODES / 2));
1185+
uint16_t num_relays = copy_connected_tcp_relays(onion_c->c, nodes, MAX_SENT_NODES / 2);
11861186
uint16_t num_nodes = closelist_nodes(onion_c->dht, &nodes[num_relays], MAX_SENT_NODES - num_relays);
11871187
num_nodes += num_relays;
11881188
int nodes_len = 0;

toxcore/state.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ int state_load(const Logger *log, state_load_cb *state_load_callback, void *oute
3434
return -1;
3535
}
3636

37-
if (lendian_to_host16((cookie_type >> 16)) != cookie_inner) {
37+
if (lendian_to_host16(cookie_type >> 16) != cookie_inner) {
3838
/* something is not matching up in a bad way, give up */
3939
LOGGER_ERROR(log, "state file garbled: %04x != %04x", cookie_type >> 16, cookie_inner);
4040
return -1;

0 commit comments

Comments
 (0)