From fd32c87707448cf25dfe1e0da28068decc89a71b Mon Sep 17 00:00:00 2001 From: iphydf Date: Sun, 12 Dec 2021 22:16:26 +0000 Subject: [PATCH] cleanup: Don't include `"config.h"` unless needed. Currently only `crypto_core_mem.c` needs this. We should try not to depend on configure'd values. Also note: config.h is only created and used in the autotools build. In CMake, we pass `-D` flags directly. --- toxav/audio.c | 4 ---- toxav/bwcontroller.c | 4 ---- toxav/groupav.c | 4 ---- toxav/msi.c | 4 ---- toxav/rtp.c | 4 ---- toxav/toxav.c | 4 ---- toxav/video.c | 4 ---- toxcore/DHT.c | 4 ---- toxcore/LAN_discovery.c | 4 ---- toxcore/Messenger.c | 4 ---- toxcore/TCP_client.c | 4 ---- toxcore/TCP_connection.c | 4 ---- toxcore/TCP_server.c | 4 ---- toxcore/crypto_core.c | 4 ---- toxcore/friend_connection.c | 4 ---- toxcore/friend_requests.c | 4 ---- toxcore/group.c | 4 ---- toxcore/list.c | 4 ---- toxcore/logger.c | 4 ---- toxcore/net_crypto.c | 4 ---- toxcore/network.c | 4 ---- toxcore/onion.c | 4 ---- toxcore/onion_announce.c | 4 ---- toxcore/onion_client.c | 4 ---- toxcore/ping.c | 4 ---- toxcore/ping_array.c | 4 ---- toxcore/tox.c | 4 ---- toxcore/util.c | 4 ---- 28 files changed, 112 deletions(-) diff --git a/toxav/audio.c b/toxav/audio.c index 8c4e3c1414..b890b9d930 100644 --- a/toxav/audio.c +++ b/toxav/audio.c @@ -2,10 +2,6 @@ * Copyright © 2016-2018 The TokTok team. * Copyright © 2013-2015 Tox project. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - #include "audio.h" #include diff --git a/toxav/bwcontroller.c b/toxav/bwcontroller.c index f1adcc7e69..001649a595 100644 --- a/toxav/bwcontroller.c +++ b/toxav/bwcontroller.c @@ -2,10 +2,6 @@ * Copyright © 2016-2018 The TokTok team. * Copyright © 2013-2015 Tox project. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - #include "bwcontroller.h" #include diff --git a/toxav/groupav.c b/toxav/groupav.c index 211d926117..fec1b5177a 100644 --- a/toxav/groupav.c +++ b/toxav/groupav.c @@ -2,10 +2,6 @@ * Copyright © 2016-2018 The TokTok team. * Copyright © 2014 Tox project. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - #include "groupav.h" #include diff --git a/toxav/msi.c b/toxav/msi.c index f753baf798..e1d7de7400 100644 --- a/toxav/msi.c +++ b/toxav/msi.c @@ -2,10 +2,6 @@ * Copyright © 2016-2018 The TokTok team. * Copyright © 2013-2015 Tox project. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - #include "msi.h" #include "../toxcore/logger.h" diff --git a/toxav/rtp.c b/toxav/rtp.c index 36c9156529..aec664b8a8 100644 --- a/toxav/rtp.c +++ b/toxav/rtp.c @@ -2,10 +2,6 @@ * Copyright © 2016-2018 The TokTok team. * Copyright © 2013-2015 Tox project. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - #include "rtp.h" #include diff --git a/toxav/toxav.c b/toxav/toxav.c index 465493be2c..8f738231d3 100644 --- a/toxav/toxav.c +++ b/toxav/toxav.c @@ -2,10 +2,6 @@ * Copyright © 2016-2018 The TokTok team. * Copyright © 2013-2015 Tox project. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - #include "toxav.h" #include "msi.h" diff --git a/toxav/video.c b/toxav/video.c index 56be17ab22..f7e95f1c51 100644 --- a/toxav/video.c +++ b/toxav/video.c @@ -2,10 +2,6 @@ * Copyright © 2016-2018 The TokTok team. * Copyright © 2013-2015 Tox project. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - #include "video.h" #include diff --git a/toxcore/DHT.c b/toxcore/DHT.c index bd8a057ccc..26fec3bb75 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c @@ -6,10 +6,6 @@ /* * An implementation of the DHT as seen in docs/updates/DHT.md */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "DHT.h" #include "LAN_discovery.h" diff --git a/toxcore/LAN_discovery.c b/toxcore/LAN_discovery.c index 3f6951fcc7..6b7a55dbda 100644 --- a/toxcore/LAN_discovery.c +++ b/toxcore/LAN_discovery.c @@ -6,10 +6,6 @@ /* * LAN discovery implementation. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "LAN_discovery.h" #include diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 5f57412d63..7e13fe2cf7 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c @@ -6,10 +6,6 @@ /* * An implementation of a simple text chat only messenger on the tox network core. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "Messenger.h" #include diff --git a/toxcore/TCP_client.c b/toxcore/TCP_client.c index c800a759b4..c5194ec49e 100644 --- a/toxcore/TCP_client.c +++ b/toxcore/TCP_client.c @@ -6,10 +6,6 @@ /* * Implementation of the TCP relay client part of Tox. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "TCP_client.h" #include diff --git a/toxcore/TCP_connection.c b/toxcore/TCP_connection.c index cb4b1ae58b..6819079470 100644 --- a/toxcore/TCP_connection.c +++ b/toxcore/TCP_connection.c @@ -6,10 +6,6 @@ /* * Handles TCP relay connections between two Tox clients. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "TCP_connection.h" #include diff --git a/toxcore/TCP_server.c b/toxcore/TCP_server.c index 2f9a69acd3..c7b0db8e83 100644 --- a/toxcore/TCP_server.c +++ b/toxcore/TCP_server.c @@ -6,10 +6,6 @@ /* * Implementation of the TCP relay server part of Tox. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "TCP_server.h" #include diff --git a/toxcore/crypto_core.c b/toxcore/crypto_core.c index c66c5329fc..1f221338a6 100644 --- a/toxcore/crypto_core.c +++ b/toxcore/crypto_core.c @@ -8,10 +8,6 @@ * * NOTE: This code has to be perfect. We don't mess around with encryption. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "crypto_core.h" #include diff --git a/toxcore/friend_connection.c b/toxcore/friend_connection.c index 496b83b505..2eb1a01d05 100644 --- a/toxcore/friend_connection.c +++ b/toxcore/friend_connection.c @@ -6,10 +6,6 @@ /* * Connection to friends. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "friend_connection.h" #include diff --git a/toxcore/friend_requests.c b/toxcore/friend_requests.c index c6c9a0e048..6d906a55d5 100644 --- a/toxcore/friend_requests.c +++ b/toxcore/friend_requests.c @@ -6,10 +6,6 @@ /* * Handle friend requests. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "friend_requests.h" #include diff --git a/toxcore/group.c b/toxcore/group.c index 00d3797253..d2cd577042 100644 --- a/toxcore/group.c +++ b/toxcore/group.c @@ -6,10 +6,6 @@ /* * Slightly better groupchats implementation. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "group.h" #include diff --git a/toxcore/list.c b/toxcore/list.c index fca8cea898..eed7aa32fc 100644 --- a/toxcore/list.c +++ b/toxcore/list.c @@ -8,10 +8,6 @@ * -Allows for finding ids associated with data such as IPs or public keys in a short time * -Should only be used if there are relatively few add/remove calls to the list */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "list.h" #include diff --git a/toxcore/logger.c b/toxcore/logger.c index 00e85c36ff..67feeeb3ba 100644 --- a/toxcore/logger.c +++ b/toxcore/logger.c @@ -6,10 +6,6 @@ /* * Text logging abstraction. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "logger.h" #include diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index ae930e8430..b4b12603d4 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c @@ -8,10 +8,6 @@ * * NOTE: This code has to be perfect. We don't mess around with encryption. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "net_crypto.h" #include diff --git a/toxcore/network.c b/toxcore/network.c index 36a2854a02..0eaad16e7b 100644 --- a/toxcore/network.c +++ b/toxcore/network.c @@ -6,10 +6,6 @@ /* * Functions for the core networking. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #ifdef __APPLE__ #define _DARWIN_C_SOURCE #endif diff --git a/toxcore/onion.c b/toxcore/onion.c index 8ed0ab1963..758015b827 100644 --- a/toxcore/onion.c +++ b/toxcore/onion.c @@ -6,10 +6,6 @@ /* * Implementation of the onion part of docs/Prevent_Tracking.txt */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "onion.h" #include diff --git a/toxcore/onion_announce.c b/toxcore/onion_announce.c index 1cfe35cbc3..56b6080e6e 100644 --- a/toxcore/onion_announce.c +++ b/toxcore/onion_announce.c @@ -6,10 +6,6 @@ /* * Implementation of the announce part of docs/Prevent_Tracking.txt */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "onion_announce.h" #include diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index d3a56af73b..67258337b2 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c @@ -7,10 +7,6 @@ * Implementation of the client part of docs/Prevent_Tracking.txt (The part that * uses the onion stuff to connect to the friend) */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "onion_client.h" #include diff --git a/toxcore/ping.c b/toxcore/ping.c index ca072ef697..8c45f4afe7 100644 --- a/toxcore/ping.c +++ b/toxcore/ping.c @@ -7,10 +7,6 @@ /* * Buffered pinging using cyclic arrays. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "ping.h" #include diff --git a/toxcore/ping_array.c b/toxcore/ping_array.c index 201b507d4c..93d9d93b51 100644 --- a/toxcore/ping_array.c +++ b/toxcore/ping_array.c @@ -6,10 +6,6 @@ /* * Implementation of an efficient array to store that we pinged something. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "ping_array.h" #include diff --git a/toxcore/tox.c b/toxcore/tox.c index e6acebe1de..e7bc5b1ce5 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c @@ -6,10 +6,6 @@ /* * The Tox public API. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #ifndef __cplusplus #ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE 600 diff --git a/toxcore/util.c b/toxcore/util.c index 2f00adacb1..c355f23628 100644 --- a/toxcore/util.c +++ b/toxcore/util.c @@ -7,10 +7,6 @@ /* * Utilities. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE 600 #endif