diff options
author | iphydf <iphydf@users.noreply.github.com> | 2020-03-18 00:42:23 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2020-03-18 00:53:02 +0000 |
commit | 1b7bf5b18299e65285c66bb498d181c2ccc2813e (patch) | |
tree | a88c912d0be1a545b58145cb55717dcd2de4c336 | |
parent | 983c2c44fe42bfaa3e62961cfbbf1c9ea504c7bb (diff) |
Mark file-local function definitions as `static`.
https://github.com/TokTok/hs-tokstyle/pull/43 implements a validation for
this. We should avoid locally declaring functions from another
translation unit, and instead use header files to export/import them.
-rw-r--r-- | toxav/bwcontroller.c | 4 | ||||
-rw-r--r-- | toxav/msi.c | 23 | ||||
-rw-r--r-- | toxav/toxav.c | 32 |
3 files changed, 30 insertions, 29 deletions
diff --git a/toxav/bwcontroller.c b/toxav/bwcontroller.c index 4440470d..9a778291 100644 --- a/toxav/bwcontroller.c +++ b/toxav/bwcontroller.c | |||
@@ -57,8 +57,8 @@ struct BWCMessage { | |||
57 | uint32_t recv; | 57 | uint32_t recv; |
58 | }; | 58 | }; |
59 | 59 | ||
60 | int bwc_handle_data(Messenger *m, uint32_t friendnumber, const uint8_t *data, uint16_t length, void *object); | 60 | static int bwc_handle_data(Messenger *m, uint32_t friendnumber, const uint8_t *data, uint16_t length, void *object); |
61 | void send_update(BWController *bwc); | 61 | static void send_update(BWController *bwc); |
62 | 62 | ||
63 | BWController *bwc_new(Messenger *m, uint32_t friendnumber, m_cb *mcb, void *mcb_user_data) | 63 | BWController *bwc_new(Messenger *m, uint32_t friendnumber, m_cb *mcb, void *mcb_user_data) |
64 | { | 64 | { |
diff --git a/toxav/msi.c b/toxav/msi.c index 69046079..aad2bb2d 100644 --- a/toxav/msi.c +++ b/toxav/msi.c | |||
@@ -61,20 +61,21 @@ typedef struct MSIMessage { | |||
61 | } MSIMessage; | 61 | } MSIMessage; |
62 | 62 | ||
63 | 63 | ||
64 | void msg_init(MSIMessage *dest, MSIRequest request); | 64 | static void msg_init(MSIMessage *dest, MSIRequest request); |
65 | int msg_parse_in(const Logger *log, MSIMessage *dest, const uint8_t *data, uint16_t length); | 65 | static int msg_parse_in(const Logger *log, MSIMessage *dest, const uint8_t *data, uint16_t length); |
66 | uint8_t *msg_parse_header_out(MSIHeaderID id, uint8_t *dest, const void *value, uint8_t value_len, uint16_t *length); | 66 | static uint8_t *msg_parse_header_out(MSIHeaderID id, uint8_t *dest, const void *value, uint8_t value_len, |
67 | uint16_t *length); | ||
67 | static int send_message(Messenger *m, uint32_t friend_number, const MSIMessage *msg); | 68 | static int send_message(Messenger *m, uint32_t friend_number, const MSIMessage *msg); |
68 | int send_error(Messenger *m, uint32_t friend_number, MSIError error); | 69 | static int send_error(Messenger *m, uint32_t friend_number, MSIError error); |
69 | static int invoke_callback(MSICall *call, MSICallbackID cb); | 70 | static int invoke_callback(MSICall *call, MSICallbackID cb); |
70 | static MSICall *get_call(MSISession *session, uint32_t friend_number); | 71 | static MSICall *get_call(MSISession *session, uint32_t friend_number); |
71 | MSICall *new_call(MSISession *session, uint32_t friend_number); | 72 | static MSICall *new_call(MSISession *session, uint32_t friend_number); |
72 | void kill_call(MSICall *call); | 73 | static void kill_call(MSICall *call); |
73 | void on_peer_status(Messenger *m, uint32_t friend_number, uint8_t status, void *data); | 74 | static void on_peer_status(Messenger *m, uint32_t friend_number, uint8_t status, void *data); |
74 | void handle_init(MSICall *call, const MSIMessage *msg); | 75 | static void handle_init(MSICall *call, const MSIMessage *msg); |
75 | void handle_push(MSICall *call, const MSIMessage *msg); | 76 | static void handle_push(MSICall *call, const MSIMessage *msg); |
76 | void handle_pop(MSICall *call, const MSIMessage *msg); | 77 | static void handle_pop(MSICall *call, const MSIMessage *msg); |
77 | void handle_msi_packet(Messenger *m, uint32_t friend_number, const uint8_t *data, uint16_t length, void *object); | 78 | static void handle_msi_packet(Messenger *m, uint32_t friend_number, const uint8_t *data, uint16_t length, void *object); |
78 | 79 | ||
79 | 80 | ||
80 | /** | 81 | /** |
diff --git a/toxav/toxav.c b/toxav/toxav.c index 597d7bea..a30bd7fb 100644 --- a/toxav/toxav.c +++ b/toxav/toxav.c | |||
@@ -102,22 +102,22 @@ struct ToxAV { | |||
102 | uint32_t interval; /** Calculated interval */ | 102 | uint32_t interval; /** Calculated interval */ |
103 | }; | 103 | }; |
104 | 104 | ||
105 | void callback_bwc(BWController *bwc, uint32_t friend_number, float loss, void *user_data); | 105 | static void callback_bwc(BWController *bwc, uint32_t friend_number, float loss, void *user_data); |
106 | 106 | ||
107 | int callback_invite(void *toxav_inst, MSICall *call); | 107 | static int callback_invite(void *toxav_inst, MSICall *call); |
108 | int callback_start(void *toxav_inst, MSICall *call); | 108 | static int callback_start(void *toxav_inst, MSICall *call); |
109 | int callback_end(void *toxav_inst, MSICall *call); | 109 | static int callback_end(void *toxav_inst, MSICall *call); |
110 | int callback_error(void *toxav_inst, MSICall *call); | 110 | static int callback_error(void *toxav_inst, MSICall *call); |
111 | int callback_capabilites(void *toxav_inst, MSICall *call); | 111 | static int callback_capabilites(void *toxav_inst, MSICall *call); |
112 | 112 | ||
113 | bool audio_bit_rate_invalid(uint32_t bit_rate); | 113 | static bool audio_bit_rate_invalid(uint32_t bit_rate); |
114 | bool video_bit_rate_invalid(uint32_t bit_rate); | 114 | static bool video_bit_rate_invalid(uint32_t bit_rate); |
115 | bool invoke_call_state_callback(ToxAV *av, uint32_t friend_number, uint32_t state); | 115 | static bool invoke_call_state_callback(ToxAV *av, uint32_t friend_number, uint32_t state); |
116 | ToxAVCall *call_new(ToxAV *av, uint32_t friend_number, Toxav_Err_Call *error); | 116 | static ToxAVCall *call_new(ToxAV *av, uint32_t friend_number, Toxav_Err_Call *error); |
117 | ToxAVCall *call_get(ToxAV *av, uint32_t friend_number); | 117 | static ToxAVCall *call_get(ToxAV *av, uint32_t friend_number); |
118 | ToxAVCall *call_remove(ToxAVCall *call); | 118 | static ToxAVCall *call_remove(ToxAVCall *call); |
119 | bool call_prepare_transmission(ToxAVCall *call); | 119 | static bool call_prepare_transmission(ToxAVCall *call); |
120 | void call_kill_transmission(ToxAVCall *call); | 120 | static void call_kill_transmission(ToxAVCall *call); |
121 | 121 | ||
122 | ToxAV *toxav_new(Tox *tox, Toxav_Err_New *error) | 122 | ToxAV *toxav_new(Tox *tox, Toxav_Err_New *error) |
123 | { | 123 | { |