Skip to content

Commit

Permalink
reformat in order to support old compilers as well
Browse files Browse the repository at this point in the history
  • Loading branch information
radkesvat committed May 15, 2024
1 parent 8bd752b commit 36adfe5
Show file tree
Hide file tree
Showing 116 changed files with 330 additions and 302 deletions.
10 changes: 5 additions & 5 deletions core/core_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,25 +273,25 @@ void parseCoreSettings(char *data_json)
// TODO (DNS) Implement dns settings and backend
}

char *getCoreLoggerFullPath()
char *getCoreLoggerFullPath(void)
{
return concat(settings->log_path, settings->core_log_file);
}
char *getNetworkLoggerFullPath()
char *getNetworkLoggerFullPath(void)
{
return concat(settings->log_path, settings->network_log_file);
}
char *getDnsLoggerFullPath()
char *getDnsLoggerFullPath(void)
{
return concat(settings->log_path, settings->dns_log_file);
}

struct core_settings_s *getCoreSettings()
struct core_settings_s *getCoreSettings(void)
{
return settings;
}

void initCoreSettings()
void initCoreSettings(void)
{
assert(settings == NULL); // we can't use logs here, so just assert

Expand Down
10 changes: 5 additions & 5 deletions core/core_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ struct core_settings_s

void parseCoreSettings(char *data_json);

char *getCoreLoggerFullPath();
char *getNetworkLoggerFullPath();
char *getDnsLoggerFullPath();
char *getCoreLoggerFullPath(void);
char *getNetworkLoggerFullPath(void);
char *getDnsLoggerFullPath(void);

struct core_settings_s *getCoreSettings();
void initCoreSettings();
struct core_settings_s *getCoreSettings(void);
void initCoreSettings(void);
2 changes: 1 addition & 1 deletion core/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ int main(void)
LOGD("Core: starting workers ...");
startSocketManager();
runMainThread();
}
}
6 changes: 3 additions & 3 deletions core/os_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#ifdef OS_UNIX
#include <sys/resource.h>
static void increaseFileLimit()
static void increaseFileLimit(void)
{

struct rlimit rlim;
Expand Down Expand Up @@ -36,8 +36,8 @@ static void increaseFileLimit()
}
}
#else
static void increaseFileLimit()
static void increaseFileLimit(void)
{
(void) (0);
}
#endif
#endif
4 changes: 2 additions & 2 deletions core/static_tunnels.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
#include "tunnels/client/reality/reality_client.h"
#endif

void loadStaticTunnelsIntoCore()
void loadStaticTunnelsIntoCore(void)
{
#ifdef INCLUDE_TCP_LISTENER
USING(TcpListener);
Expand Down Expand Up @@ -233,4 +233,4 @@ void loadStaticTunnelsIntoCore()
#ifdef INCLUDE_REALITY_CLIENT
USING(RealityClient);
#endif
}
}
2 changes: 1 addition & 1 deletion core/static_tunnels.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@



void loadStaticTunnelsIntoCore();
void loadStaticTunnelsIntoCore(void);
6 changes: 3 additions & 3 deletions tunnels/adapters/bridge/bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ typedef struct bridge_state_s

typedef struct bridge_con_state_s
{

void*_;
} bridge_con_state_t;

static void upStream(tunnel_t *self, context_t *c)
Expand Down Expand Up @@ -119,7 +119,7 @@ tunnel_t *destroyBridge(tunnel_t *self)

return NULL;
}
tunnel_metadata_t getMetadataBridge()
tunnel_metadata_t getMetadataBridge(void)
{
return (tunnel_metadata_t){.version = 0001, .flags = kNodeFlagChainHead};
}
}
2 changes: 1 addition & 1 deletion tunnels/adapters/bridge/bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
tunnel_t * newBridge(node_instance_context_t *instance_info);
api_result_t apiBridge(tunnel_t *self, const char *msg);
tunnel_t * destroyBridge(tunnel_t *self);
tunnel_metadata_t getMetadataBridge();
tunnel_metadata_t getMetadataBridge(void);
6 changes: 3 additions & 3 deletions tunnels/adapters/connector/connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ typedef struct connector_state_s

typedef struct connector_con_state_s
{

void*_;
} connector_con_state_t;

static void upStream(tunnel_t *self, context_t *c)
Expand Down Expand Up @@ -84,7 +84,7 @@ tunnel_t *destroyConnector(tunnel_t *self)
(void) (self);
return NULL;
}
tunnel_metadata_t getMetadataConnector()
tunnel_metadata_t getMetadataConnector(void)
{
return (tunnel_metadata_t){.version = 0001, .flags = 0x0};
}
}
2 changes: 1 addition & 1 deletion tunnels/adapters/connector/connector.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
tunnel_t * newConnector(node_instance_context_t *instance_info);
api_result_t apiConnector(tunnel_t *self, const char *msg);
tunnel_t * destroyConnector(tunnel_t *self);
tunnel_metadata_t getMetadataConnector();
tunnel_metadata_t getMetadataConnector(void);
4 changes: 2 additions & 2 deletions tunnels/adapters/connector/tcp/tcp_connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ tunnel_t *destroyTcpConnector(tunnel_t *self)
(void) (self);
return NULL;
}
tunnel_metadata_t getMetadataTcpConnector()
tunnel_metadata_t getMetadataTcpConnector(void)
{
return (tunnel_metadata_t){.version = 0001, .flags = 0x0};
}
}
2 changes: 1 addition & 1 deletion tunnels/adapters/connector/tcp/tcp_connector.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
tunnel_t * newTcpConnector(node_instance_context_t *instance_info);
api_result_t apiTcpConnector(tunnel_t *self, const char *msg);
tunnel_t * destroyTcpConnector(tunnel_t *self);
tunnel_metadata_t getMetadataTcpConnector();
tunnel_metadata_t getMetadataTcpConnector(void);
4 changes: 2 additions & 2 deletions tunnels/adapters/connector/udp/udp_connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ tunnel_t *destroyUdpConnector(tunnel_t *self)
(void) (self);
return NULL;
}
tunnel_metadata_t getMetadataUdpConnector()
tunnel_metadata_t getMetadataUdpConnector(void)
{
return (tunnel_metadata_t){.version = 0001, .flags = 0x0};
}
}
2 changes: 1 addition & 1 deletion tunnels/adapters/connector/udp/udp_connector.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
tunnel_t * newUdpConnector(node_instance_context_t *instance_info);
api_result_t apiUdpConnector(tunnel_t *self, const char *msg);
tunnel_t * destroyUdpConnector(tunnel_t *self);
tunnel_metadata_t getMetadataUdpConnector();
tunnel_metadata_t getMetadataUdpConnector(void);
6 changes: 3 additions & 3 deletions tunnels/adapters/listener/listener.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ typedef struct listener_state_s

typedef struct listener_con_state_s
{

void*_;
} listener_con_state_t;

// set function pointers baby))
Expand Down Expand Up @@ -100,7 +100,7 @@ tunnel_t *destroyListener(tunnel_t *self)
(void) (self);
return NULL;
}
tunnel_metadata_t getMetadataListener()
tunnel_metadata_t getMetadataListener(void)
{
return (tunnel_metadata_t){.version = 0001, .flags = kNodeFlagChainHead};
}
}
2 changes: 1 addition & 1 deletion tunnels/adapters/listener/listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
tunnel_t * newListener(node_instance_context_t *instance_info);
api_result_t apiListener(tunnel_t *self, const char *msg);
tunnel_t * destroyListener(tunnel_t *self);
tunnel_metadata_t getMetadataListener();
tunnel_metadata_t getMetadataListener(void);
4 changes: 2 additions & 2 deletions tunnels/adapters/listener/tcp/tcp_listener.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ tunnel_t *destroyTcpListener(tunnel_t *self)
(void) (self);
return NULL;
}
tunnel_metadata_t getMetadataTcpListener()
tunnel_metadata_t getMetadataTcpListener(void)
{
return (tunnel_metadata_t){.version = 0001, .flags = kNodeFlagChainHead};
}
}
2 changes: 1 addition & 1 deletion tunnels/adapters/listener/tcp/tcp_listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
tunnel_t *newTcpListener(node_instance_context_t *instance_info);
api_result_t apiTcpListener(tunnel_t *self, const char *msg);
tunnel_t *destroyTcpListener(tunnel_t *self);
tunnel_metadata_t getMetadataTcpListener();
tunnel_metadata_t getMetadataTcpListener(void);
6 changes: 3 additions & 3 deletions tunnels/adapters/listener/udp/udp_listener.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static void cleanup(udp_listener_con_state_t *cstate)
// sounds impossible...
LOGE("Checkpoint udp listener");
// this prevent double free
*cstate = (udp_listener_con_state_t){};
*cstate = (udp_listener_con_state_t){0};
}
}
else
Expand Down Expand Up @@ -364,7 +364,7 @@ tunnel_t *destroyUdpListener(tunnel_t *self)
(void) (self);
return NULL;
}
tunnel_metadata_t getMetadataUdpListener()
tunnel_metadata_t getMetadataUdpListener(void)
{
return (tunnel_metadata_t){.version = 0001, .flags = kNodeFlagChainHead};
}
}
2 changes: 1 addition & 1 deletion tunnels/adapters/listener/udp/udp_listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
tunnel_t * newUdpListener(node_instance_context_t *instance_info);
api_result_t apiUdpListener(tunnel_t *self, const char *msg);
tunnel_t * destroyUdpListener(tunnel_t *self);
tunnel_metadata_t getMetadataUdpListener();
tunnel_metadata_t getMetadataUdpListener(void);
6 changes: 3 additions & 3 deletions tunnels/client/header/header_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ typedef struct header_client_state_s

typedef struct header_client_con_state_s
{

void*_;
} header_client_con_state_t;

static void upStream(tunnel_t *self, context_t *c)
Expand Down Expand Up @@ -81,7 +81,7 @@ tunnel_t *destroyHeaderClient(tunnel_t *self)
(void) (self);
return NULL;
}
tunnel_metadata_t getMetadataHeaderClient()
tunnel_metadata_t getMetadataHeaderClient(void)
{
return (tunnel_metadata_t){.version = 0001, .flags = 0x0};
}
}
2 changes: 1 addition & 1 deletion tunnels/client/header/header_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
tunnel_t *newHeaderClient(node_instance_context_t *instance_info);
api_result_t apiHeaderClient(tunnel_t *self, const char *msg);
tunnel_t *destroyHeaderClient(tunnel_t *self);
tunnel_metadata_t getMetadataHeaderClient();
tunnel_metadata_t getMetadataHeaderClient(void);



5 changes: 3 additions & 2 deletions tunnels/client/http2/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
#include "tunnel.h"
#include "types.h"

#define kMaxConcurrentStreams 0xffffffffU // NOLINT

enum
{
kMaxConcurrentStreams = 0xffffffffU,
kPingInterval = 5000
kPingInterval = 5000
};

static void onPingTimer(htimer_t *timer);
Expand Down
2 changes: 1 addition & 1 deletion tunnels/client/http2/http2_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ tunnel_t *destroyHttp2Client(tunnel_t *self)
return NULL;
}

tunnel_metadata_t getMetadataHttp2Client()
tunnel_metadata_t getMetadataHttp2Client(void)
{
return (tunnel_metadata_t){.version = 0001, .flags = 0x0};
}
2 changes: 1 addition & 1 deletion tunnels/client/http2/http2_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
tunnel_t * newHttp2Client(node_instance_context_t *instance_info);
api_result_t apiHttp2Client(tunnel_t *self,const char *msg);
tunnel_t * destroyHttp2Client(tunnel_t *self);
tunnel_metadata_t getMetadataHttp2Client();
tunnel_metadata_t getMetadataHttp2Client(void);
2 changes: 1 addition & 1 deletion tunnels/client/openssl/openssl_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ tunnel_t *destroyOpenSSLClient(tunnel_t *self)
return NULL;
}

tunnel_metadata_t getMetadataOpenSSLClient()
tunnel_metadata_t getMetadataOpenSSLClient(void)
{
return (tunnel_metadata_t){.version = 0001, .flags = 0x0};
}
2 changes: 1 addition & 1 deletion tunnels/client/openssl/openssl_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
tunnel_t * newOpenSSLClient(node_instance_context_t *instance_info);
api_result_t apiOpenSSLClient(tunnel_t *self, const char *msg);
tunnel_t * destroyOpenSSLClient(tunnel_t *self);
tunnel_metadata_t getMetadataOpenSSLClient();
tunnel_metadata_t getMetadataOpenSSLClient(void);
17 changes: 10 additions & 7 deletions tunnels/client/preconnect/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
#include "types.h"
#include "utils/mathutils.h"

#define PRECONNECT_DELAY_SHORT 10
#define PRECONNECT_DELAY_HIGH 750
enum
{
kPreconnectDelayShort = 10,
kPreconnectDelayHigh = 750
};

static void addConnection(thread_box_t *box, preconnect_client_con_state_t *con)
{
Expand Down Expand Up @@ -43,8 +46,8 @@ static void destroyCstate(preconnect_client_con_state_t *cstate)
}
static void doConnect(struct connect_arg *cg)
{
tunnel_t * self = cg->t;
preconnect_client_state_t * state = STATE(self);
tunnel_t *self = cg->t;
preconnect_client_state_t *state = STATE(self);
preconnect_client_con_state_t *cstate = createCstate(cg->tid);
free(cg);
(cstate->u->chains_state)[self->chain_index] = cstate;
Expand All @@ -59,7 +62,7 @@ static void connectTimerFinished(htimer_t *timer)
static void beforeConnect(hevent_t *ev)
{
struct connect_arg *cg = hevent_userdata(ev);
htimer_t * connect_timer = htimer_add(loops[cg->tid], connectTimerFinished, cg->delay, 1);
htimer_t *connect_timer = htimer_add(loops[cg->tid], connectTimerFinished, cg->delay, 1);
if (connect_timer)
{
hevent_set_userdata(connect_timer, cg);
Expand Down Expand Up @@ -100,8 +103,8 @@ static void initiateConnect(tunnel_t *self, bool delay)
struct connect_arg *cg = malloc(sizeof(struct connect_arg));
cg->t = self;
cg->tid = tid;
cg->delay = delay ? PRECONNECT_DELAY_HIGH : PRECONNECT_DELAY_SHORT;
cg->delay = delay ? kPreconnectDelayHigh : kPreconnectDelayShort;
ev.userdata = cg;

hloop_post_event(worker_loop, &ev);
}
}
4 changes: 2 additions & 2 deletions tunnels/client/preconnect/preconnect_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ tunnel_t *destroyPreConnectClient(tunnel_t *self)
(void) (self);
return NULL;
}
tunnel_metadata_t getMetadataPreConnectClient()
tunnel_metadata_t getMetadataPreConnectClient(void)
{
return (tunnel_metadata_t){.version = 0001, .flags = 0x0};
}
}
2 changes: 1 addition & 1 deletion tunnels/client/preconnect/preconnect_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
tunnel_t * newPreConnectClient(node_instance_context_t *instance_info);
api_result_t apiPreConnectClient(tunnel_t *self, const char *msg);
tunnel_t * destroyPreConnectClient(tunnel_t *self);
tunnel_metadata_t getMetadataPreConnectClient();
tunnel_metadata_t getMetadataPreConnectClient(void);
Loading

0 comments on commit 36adfe5

Please sign in to comment.