Group #include directives in 3-4 groups.

1. Current module (if C file).
2. Headers from current library.
3. Headers from other library (e.g. toxcore includes in toxav).
4. System headers.
This commit is contained in:
iphydf 2016-09-11 15:47:51 +01:00
parent 2b2dc07f6f
commit 0aa2840164
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
38 changed files with 94 additions and 75 deletions

View File

@ -23,13 +23,14 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <stdlib.h>
#include "audio.h"
#include "rtp.h"
#include "../toxcore/logger.h"
#include <stdlib.h>
static struct JitterBuffer *jbuf_new(uint32_t capacity);
static void jbuf_clear(struct JitterBuffer *q);
static void jbuf_free(struct JitterBuffer *q);

View File

@ -22,14 +22,14 @@
#ifndef AUDIO_H
#define AUDIO_H
#include <opus.h>
#include <pthread.h>
#include "toxav.h"
#include "../toxcore/logger.h"
#include "../toxcore/util.h"
#include <opus.h>
#include <pthread.h>
struct RTPMessage;
typedef struct ACSession_s {

View File

@ -23,9 +23,11 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "bwcontroller.h"
#include "../toxcore/logger.h"
#include "../toxcore/util.h"
#include "bwcontroller.h"
#include <assert.h>
#define BWC_PACKET_ID 196

View File

@ -21,6 +21,7 @@
#ifndef BWCONROLER_H
#define BWCONROLER_H
#include "../toxcore/Messenger.h"
typedef struct BWController_s BWController;

View File

@ -22,9 +22,10 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "group.h"
#include "../toxcore/logger.h"
#include "../toxcore/util.h"
#include "group.h"
#define GROUP_JBUF_SIZE 6
#define GROUP_JBUF_DEAD_SECONDS 4

View File

@ -18,11 +18,11 @@
* along with Tox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../toxcore/group.h"
/* Audio encoding/decoding */
#include <opus.h>
#include "../toxcore/group.h"
#define GROUP_AUDIO_PACKET_ID 192
/* Create a new toxav group.

View File

@ -24,9 +24,10 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "msi.h"
#include "../toxcore/logger.h"
#include "../toxcore/util.h"
#include "msi.h"
#include <assert.h>
#include <stdbool.h>

View File

@ -22,13 +22,14 @@
#ifndef MSI_H
#define MSI_H
#include <inttypes.h>
#include <pthread.h>
#include "../toxcore/Messenger.h"
#include "audio.h"
#include "video.h"
#include "../toxcore/Messenger.h"
#include <inttypes.h>
#include <pthread.h>
/**
* Error codes.
*/

View File

@ -23,11 +23,13 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "rtp.h"
#include "bwcontroller.h"
#include "../toxcore/Messenger.h"
#include "../toxcore/logger.h"
#include "../toxcore/util.h"
#include "bwcontroller.h"
#include "rtp.h"
#include <assert.h>
#include <stdlib.h>

View File

@ -22,9 +22,11 @@
#ifndef RTP_H
#define RTP_H
#include "../toxcore/Messenger.h"
#include "bwcontroller.h"
#include "stdbool.h"
#include "../toxcore/Messenger.h"
#include <stdbool.h>
/**
* Payload type identifier. Also used as rtp callback prefix.

View File

@ -23,6 +23,8 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "toxav.h"
#include "msi.h"
#include "rtp.h"

View File

@ -22,9 +22,10 @@
* This file contains the group chats code for the backwards compatibility.
*/
#include "group.h"
#include "toxav.h"
#include "group.h"
/* Create a new toxav group.
*
* return group number on success.

View File

@ -23,16 +23,17 @@
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <assert.h>
#include <stdlib.h>
#include "video.h"
#include "msi.h"
#include "rtp.h"
#include "video.h"
#include "../toxcore/logger.h"
#include "../toxcore/network.h"
#include <assert.h>
#include <stdlib.h>
#define MAX_DECODE_TIME_US 0 /* Good quality encode. */
#define VIDEO_DECODE_BUFFER_SIZE 20

View File

@ -22,6 +22,11 @@
#ifndef VIDEO_H
#define VIDEO_H
#include "toxav.h"
#include "../toxcore/logger.h"
#include "../toxcore/util.h"
#include <vpx/vpx_decoder.h>
#include <vpx/vpx_encoder.h>
#include <vpx/vpx_image.h>
@ -33,11 +38,6 @@
#include <pthread.h>
#include "toxav.h"
#include "../toxcore/logger.h"
#include "../toxcore/util.h"
struct RTPMessage;
typedef struct VCSession_s {

View File

@ -27,23 +27,20 @@
#include "config.h"
#endif
#include <assert.h>
#include "logger.h"
#include "DHT.h"
#ifdef ENABLE_ASSOC_DHT
#include "assoc.h"
#endif
#include "ping.h"
#include "LAN_discovery.h"
#include "logger.h"
#include "misc_tools.h"
#include "network.h"
#include "ping.h"
#include "util.h"
#include <assert.h>
/* The timeout after which a node is discarded completely. */
#define KILL_NODE_TIMEOUT (BAD_NODE_TIMEOUT + PING_INTERVAL)

View File

@ -26,6 +26,7 @@
#endif
#include "LAN_discovery.h"
#include "util.h"
/* Used for get_broadcast(). */

View File

@ -25,7 +25,6 @@
#ifndef LAN_DISCOVERY_H
#define LAN_DISCOVERY_H
#include "DHT.h"
/* Interval in seconds between LAN discovery packet sending. */

View File

@ -25,16 +25,17 @@
#include "config.h"
#endif
#ifdef TOX_DEBUG
#include <assert.h>
#endif
#include "Messenger.h"
#include "assoc.h"
#include "logger.h"
#include "network.h"
#include "util.h"
#ifdef TOX_DEBUG
#include <assert.h>
#endif
static void set_friend_status(Messenger *m, int32_t friendnumber, uint8_t status, void *userdata);
static int write_cryptpacket_id(const Messenger *m, int32_t friendnumber, uint8_t packet_id, const uint8_t *data,

View File

@ -26,12 +26,12 @@
#include "TCP_client.h"
#include "util.h"
#if !defined(_WIN32) && !defined(__WIN32__) && !defined (WIN32)
#include <sys/ioctl.h>
#endif
#include "util.h"
/* return 1 on success
* return 0 on failure
*/

View File

@ -26,6 +26,7 @@
#endif
#include "TCP_connection.h"
#include "util.h"
/* Set the size of the array to num.

View File

@ -26,12 +26,12 @@
#include "TCP_server.h"
#include "util.h"
#if !defined(_WIN32) && !defined(__WIN32__) && !defined (WIN32)
#include <sys/ioctl.h>
#endif
#include "util.h"
/* return 1 on success
* return 0 on failure
*/

View File

@ -28,7 +28,7 @@
#include "onion.h"
#ifdef TCP_SERVER_USE_EPOLL
#include "sys/epoll.h"
#include <sys/epoll.h>
#endif
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__MACH__)

View File

@ -1,16 +1,15 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "DHT.h"
#include "assoc.h"
#include "DHT.h"
#include "LAN_discovery.h"
#include "logger.h"
#include "ping.h"
#include "LAN_discovery.h"
#include "util.h"
#include <assert.h>
/*

View File

@ -26,6 +26,7 @@
#endif
#include "friend_connection.h"
#include "util.h"
/* return 1 if the friendcon_id is not valid.

View File

@ -30,7 +30,6 @@
#include "net_crypto.h"
#include "onion_client.h"
#define MAX_FRIEND_CONNECTION_CALLBACKS 2
#define MESSENGER_CALLBACK_INDEX 0
#define GROUPCHAT_CALLBACK_INDEX 1

View File

@ -26,8 +26,8 @@
#endif
#include "friend_requests.h"
#include "util.h"
#include "util.h"
/* Set and get the nospam variable used to prevent one type of friend request spam. */
void set_nospam(Friend_Requests *fr, uint32_t num)

View File

@ -26,6 +26,7 @@
#endif
#include "group.h"
#include "util.h"
/* return 1 if the groupnumber is not valid.

View File

@ -27,10 +27,13 @@
#include "config.h"
#endif
#include "math.h"
#include "net_crypto.h"
#include "util.h"
#include <math.h>
static uint8_t crypt_connection_id_not_valid(const Net_Crypto *c, int crypt_connection_id)
{
if ((uint32_t)crypt_connection_id >= c->crypto_connections_length) {

View File

@ -28,6 +28,7 @@
#include "LAN_discovery.h"
#include "TCP_connection.h"
#include "logger.h"
#include <pthread.h>
#define CRYPTO_CONN_NO_CONNECTION 0

View File

@ -29,7 +29,10 @@
#include "config.h"
#endif
#include "network.h"
#include "logger.h"
#include "util.h"
#if !defined(_WIN32) && !defined(__WIN32__) && !defined (WIN32)
#include <errno.h>
@ -40,9 +43,6 @@
#include <mach/mach.h>
#endif
#include "network.h"
#include "util.h"
#if defined(_WIN32) || defined(__WIN32__) || defined (WIN32)
static const char *inet_ntop(sa_family_t family, void *addr, char *buf, size_t bufsize)

View File

@ -24,6 +24,7 @@
#endif
#include "onion.h"
#include "util.h"
#define RETURN_1 ONION_RETURN_1

View File

@ -23,8 +23,9 @@
#include "config.h"
#endif
#include "LAN_discovery.h"
#include "onion_announce.h"
#include "LAN_discovery.h"
#include "util.h"
#define PING_ID_TIMEOUT 20

View File

@ -24,8 +24,9 @@
#include "config.h"
#endif
#include "LAN_discovery.h"
#include "onion_client.h"
#include "LAN_discovery.h"
#include "util.h"
/* defines for the array size and

View File

@ -27,15 +27,15 @@
#include "config.h"
#endif
#include <stdint.h>
#include "DHT.h"
#include "ping.h"
#include "DHT.h"
#include "network.h"
#include "ping_array.h"
#include "util.h"
#include <stdint.h>
#define PING_NUM_MAX 512
/* Maximum newly announced nodes to ping per TIME_TO_PING seconds. */

View File

@ -26,8 +26,9 @@
#include "config.h"
#endif
#include "crypto_core.h"
#include "ping_array.h"
#include "crypto_core.h"
#include "util.h"
static void clear_entry(Ping_Array *array, uint32_t index)

View File

@ -25,17 +25,16 @@
#include "config.h"
#endif
#define TOX_DEFINED
typedef struct Messenger Tox;
#include "tox.h"
#include "Messenger.h"
#include "group.h"
#include "logger.h"
#include "../toxencryptsave/defines.h"
#define TOX_DEFINED
typedef struct Messenger Tox;
#include "tox.h"
#define SET_ERROR_PARAMETER(param, x) {if(param) {*param = x;}}
#if TOX_HASH_LENGTH != crypto_hash_sha256_BYTES

View File

@ -25,13 +25,12 @@
#include "config.h"
#endif
#include "Messenger.h"
#include "group.h"
#define TOX_DEFINED
typedef struct Messenger Tox;
#include "tox_group.h"
#include "tox.h"
#include "Messenger.h"
#include "group.h"
/**********GROUP CHAT FUNCTIONS: WARNING Group chats will be rewritten so this might change ************/

View File

@ -26,13 +26,12 @@
#include "config.h"
#endif
#include <time.h>
/* for crypto_box_PUBLICKEYBYTES */
#include "crypto_core.h"
#include "util.h"
#include "crypto_core.h" /* for crypto_box_PUBLICKEYBYTES */
#include <time.h>
/* don't call into system billions of times for no reason */
static uint64_t unix_time_value;