From 8739f7fccb7cafc54ca0f5fa074c9a740f7048ba Mon Sep 17 00:00:00 2001 From: iphydf Date: Thu, 5 Jul 2018 10:31:29 +0000 Subject: Make tox.c unambiguously parseable. Rules: 1. Constants are uppercase names: THE_CONSTANT. 2. SUE[1] types start with an uppercase letter and have at least one lowercase letter in it: The_Type, THE_Type. 3. Function types end in "_cb": tox_friend_connection_cb. 4. Variable and function names are all lowercase: the_function. This makes it easier for humans reading the code to determine what an identifier means. I'm not convinced by the enum type name change, but I don't know a better rule. Currently, a lot of enum types are spelled like constants, which is confusing. [1] struct/union/enum --- toxcore/friend_requests.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'toxcore/friend_requests.h') diff --git a/toxcore/friend_requests.h b/toxcore/friend_requests.h index e6948b6c..91571775 100644 --- a/toxcore/friend_requests.h +++ b/toxcore/friend_requests.h @@ -41,11 +41,12 @@ uint32_t get_nospam(const Friend_Requests *fr); */ int remove_request_received(Friend_Requests *fr, const uint8_t *real_pk); +typedef void fr_friend_request_cb(void *, const uint8_t *, const uint8_t *, size_t, void *); + /* Set the function that will be executed when a friend request for us is received. * Function format is function(uint8_t * public_key, uint8_t * data, size_t length, void * userdata) */ -void callback_friendrequest(Friend_Requests *fr, void (*function)(void *, const uint8_t *, const uint8_t *, size_t, - void *), void *object); +void callback_friendrequest(Friend_Requests *fr, fr_friend_request_cb *function, void *object); /* Set the function used to check if a friend request should be displayed to the user or not. * Function format is int function(uint8_t * public_key, void * userdata) -- cgit v1.2.3