Browse Source

Rename callback functions types from _f to _fn. For unification

Serj Kalichev 3 years ago
parent
commit
769b7bc1fb
6 changed files with 28 additions and 28 deletions
  1. 4 4
      faux/async.h
  2. 2 2
      faux/async/async.c
  3. 2 2
      faux/async/private.h
  4. 8 8
      faux/eloop.h
  5. 10 10
      faux/eloop/eloop.c
  6. 2 2
      faux/eloop/private.h

+ 4 - 4
faux/async.h

@@ -14,9 +14,9 @@ typedef struct faux_async_s faux_async_t;
 
 
 // Callback function prototypes
-typedef bool_t (*faux_async_read_cb_f)(faux_async_t *async,
+typedef bool_t (*faux_async_read_cb_fn)(faux_async_t *async,
 	void *data, size_t len, void *user_data);
-typedef bool_t (*faux_async_stall_cb_f)(faux_async_t *async,
+typedef bool_t (*faux_async_stall_cb_fn)(faux_async_t *async,
 	size_t len, void *user_data);
 
 
@@ -26,10 +26,10 @@ faux_async_t *faux_async_new(int fd);
 void faux_async_free(faux_async_t *async);
 int faux_async_fd(const faux_async_t *async);
 void faux_async_set_read_cb(faux_async_t *async,
-	faux_async_read_cb_f read_cb, void *user_data);
+	faux_async_read_cb_fn read_cb, void *user_data);
 bool_t faux_async_set_read_limits(faux_async_t *async, size_t min, size_t max);
 void faux_async_set_stall_cb(faux_async_t *async,
-	faux_async_stall_cb_f stall_cb, void *user_data);
+	faux_async_stall_cb_fn stall_cb, void *user_data);
 void faux_async_set_write_overflow(faux_async_t *async, size_t overflow);
 void faux_async_set_read_overflow(faux_async_t *async, size_t overflow);
 ssize_t faux_async_write(faux_async_t *async, void *data, size_t len);

+ 2 - 2
faux/async/async.c

@@ -142,7 +142,7 @@ int faux_async_fd(const faux_async_t *async)
  * @param [in] user_data Associated user data.
  */
 void faux_async_set_read_cb(faux_async_t *async,
-	faux_async_read_cb_f read_cb, void *user_data)
+	faux_async_read_cb_fn read_cb, void *user_data)
 {
 	assert(async);
 	if (!async)
@@ -190,7 +190,7 @@ bool_t faux_async_set_read_limits(faux_async_t *async, size_t min, size_t max)
  * @param [in] user_data Associated user data.
  */
 void faux_async_set_stall_cb(faux_async_t *async,
-	faux_async_stall_cb_f stall_cb, void *user_data)
+	faux_async_stall_cb_fn stall_cb, void *user_data)
 {
 	assert(async);
 	if (!async)

+ 2 - 2
faux/async/private.h

@@ -7,7 +7,7 @@ struct faux_async_s {
 	int fd;
 
 	// Read
-	faux_async_read_cb_f read_cb; // Read callback
+	faux_async_read_cb_fn read_cb; // Read callback
 	void *read_udata;
 	size_t min;
 	size_t max;
@@ -18,7 +18,7 @@ struct faux_async_s {
 	size_t i_overflow;
 
 	// Write
-	faux_async_stall_cb_f stall_cb; // Stall callback
+	faux_async_stall_cb_fn stall_cb; // Stall callback
 	void *stall_udata;
 	faux_list_t *o_list;
 	size_t o_rpos;

+ 8 - 8
faux/eloop.h

@@ -32,33 +32,33 @@ typedef struct {
 } faux_eloop_info_signal_t;
 
 // Callback function prototype
-typedef bool_t (*faux_eloop_cb_f)(faux_eloop_t *eloop, faux_eloop_type_e type,
+typedef bool_t (*faux_eloop_cb_fn)(faux_eloop_t *eloop, faux_eloop_type_e type,
 	void *associated_data, void *user_data);
 
 
 C_DECL_BEGIN
 
-faux_eloop_t *faux_eloop_new(faux_eloop_cb_f default_event_cb);
+faux_eloop_t *faux_eloop_new(faux_eloop_cb_fn default_event_cb);
 void faux_eloop_free(faux_eloop_t *eloop);
 bool_t faux_eloop_loop(faux_eloop_t *eloop);
 
 bool_t faux_eloop_add_fd(faux_eloop_t *eloop, int fd, short events,
-	faux_eloop_cb_f event_cb, void *user_data);
+	faux_eloop_cb_fn event_cb, void *user_data);
 bool_t faux_eloop_del_fd(faux_eloop_t *eloop, int fd);
 
 bool_t faux_eloop_add_signal(faux_eloop_t *eloop, int signo,
-	faux_eloop_cb_f event_cb, void *user_data);
+	faux_eloop_cb_fn event_cb, void *user_data);
 bool_t faux_eloop_del_signal(faux_eloop_t *eloop, int signo);
 
 faux_ev_t *faux_eloop_add_sched_once(faux_eloop_t *eloop, const struct timespec *time,
-	int ev_id, faux_eloop_cb_f event_cb, void *data);
+	int ev_id, faux_eloop_cb_fn event_cb, void *data);
 faux_ev_t *faux_eloop_add_sched_once_delayed(faux_eloop_t *eloop, const struct timespec *interval,
-	int ev_id, faux_eloop_cb_f event_cb, void *data);
+	int ev_id, faux_eloop_cb_fn event_cb, void *data);
 faux_ev_t *faux_eloop_add_sched_periodic(faux_eloop_t *eloop, const struct timespec *time,
-	int ev_id, faux_eloop_cb_f event_cb, void *data,
+	int ev_id, faux_eloop_cb_fn event_cb, void *data,
 	const struct timespec *period, unsigned int cycle_num);
 faux_ev_t *faux_eloop_add_sched_periodic_delayed(faux_eloop_t *eloop,
-	int ev_id, faux_eloop_cb_f event_cb, void *data,
+	int ev_id, faux_eloop_cb_fn event_cb, void *data,
 	const struct timespec *period, unsigned int cycle_num);
 ssize_t faux_eloop_del_sched(faux_eloop_t *eloop, faux_ev_t *ev);
 ssize_t faux_eloop_del_sched_by_id(faux_eloop_t *eloop, int ev_id);

+ 10 - 10
faux/eloop/eloop.c

@@ -122,7 +122,7 @@ static int faux_eloop_signal_kcompare(const void *key, const void *list_item)
  * @param [in] default_event_cb Default event callback.
  * @return Allocated faux_eloop_t object or NULL on error.
  */
-faux_eloop_t *faux_eloop_new(faux_eloop_cb_f default_event_cb)
+faux_eloop_t *faux_eloop_new(faux_eloop_cb_fn default_event_cb)
 {
 	faux_eloop_t *eloop = NULL;
 
@@ -294,7 +294,7 @@ bool_t faux_eloop_loop(faux_eloop_t *eloop)
 				int ev_id = faux_ev_id(ev);
 				faux_eloop_context_t *context =
 					(faux_eloop_context_t *)faux_ev_data(ev);
-				faux_eloop_cb_f event_cb = context->event_cb;
+				faux_eloop_cb_fn event_cb = context->event_cb;
 				void *user_data = context->user_data;
 
 				if (!faux_ev_is_busy(ev)) {
@@ -324,7 +324,7 @@ bool_t faux_eloop_loop(faux_eloop_t *eloop)
 		while ((pollfd = faux_pollfd_each_active(eloop->pollfds, &pollfd_iter))) {
 			int fd = pollfd->fd;
 			faux_eloop_info_fd_t info = {};
-			faux_eloop_cb_f event_cb = NULL;
+			faux_eloop_cb_fn event_cb = NULL;
 			faux_eloop_fd_t *entry = NULL;
 			bool_t r = BOOL_TRUE;
 
@@ -430,7 +430,7 @@ bool_t faux_eloop_loop(faux_eloop_t *eloop)
  * @return BOOL_TRUE - success, BOOL_FALSE - error.
  */
 bool_t faux_eloop_add_fd(faux_eloop_t *eloop, int fd, short events,
-	faux_eloop_cb_f event_cb, void *user_data)
+	faux_eloop_cb_fn event_cb, void *user_data)
 {
 	faux_eloop_fd_t *entry = NULL;
 	faux_list_node_t *new_node = NULL;
@@ -566,7 +566,7 @@ bool_t faux_eloop_del_fd(faux_eloop_t *eloop, int fd)
  * @return BOOL_TRUE - success, BOOL_FALSE - error.
  */
 bool_t faux_eloop_add_signal(faux_eloop_t *eloop, int signo,
-	faux_eloop_cb_f event_cb, void *user_data)
+	faux_eloop_cb_fn event_cb, void *user_data)
 {
 	faux_eloop_signal_t *entry = NULL;
 
@@ -660,7 +660,7 @@ bool_t faux_eloop_del_signal(faux_eloop_t *eloop, int signo)
  * @return Allocated context structure or NULL on error.
  */
 static faux_eloop_context_t *faux_eloop_new_context(
-	faux_eloop_cb_f event_cb, void *data)
+	faux_eloop_cb_fn event_cb, void *data)
 {
 	faux_eloop_context_t *context = NULL;
 
@@ -686,7 +686,7 @@ static faux_eloop_context_t *faux_eloop_new_context(
  * @return Pointer to created faux_ev_t object or NULL on error.
  */
 faux_ev_t *faux_eloop_add_sched_once(faux_eloop_t *eloop, const struct timespec *time,
-	int ev_id, faux_eloop_cb_f event_cb, void *data)
+	int ev_id, faux_eloop_cb_fn event_cb, void *data)
 {
 	faux_eloop_context_t *context = NULL;
 	faux_ev_t *ev = NULL;
@@ -720,7 +720,7 @@ faux_ev_t *faux_eloop_add_sched_once(faux_eloop_t *eloop, const struct timespec
  * @return Pointer to created faux_ev_t object or NULL on error.
  */
 faux_ev_t *faux_eloop_add_sched_once_delayed(faux_eloop_t *eloop, const struct timespec *interval,
-	int ev_id, faux_eloop_cb_f event_cb, void *data)
+	int ev_id, faux_eloop_cb_fn event_cb, void *data)
 {
 	faux_eloop_context_t *context = NULL;
 	faux_ev_t *ev = NULL;
@@ -756,7 +756,7 @@ faux_ev_t *faux_eloop_add_sched_once_delayed(faux_eloop_t *eloop, const struct t
  * @return Pointer to created faux_ev_t object or NULL on error.
  */
 faux_ev_t *faux_eloop_add_sched_periodic(faux_eloop_t *eloop, const struct timespec *time,
-	int ev_id, faux_eloop_cb_f event_cb, void *data,
+	int ev_id, faux_eloop_cb_fn event_cb, void *data,
 	const struct timespec *period, unsigned int cycle_num)
 {
 	faux_eloop_context_t *context = NULL;
@@ -793,7 +793,7 @@ faux_ev_t *faux_eloop_add_sched_periodic(faux_eloop_t *eloop, const struct times
  * @return Pointer to created faux_ev_t object or NULL on error.
  */
 faux_ev_t *faux_eloop_add_sched_periodic_delayed(faux_eloop_t *eloop,
-	int ev_id, faux_eloop_cb_f event_cb, void *data,
+	int ev_id, faux_eloop_cb_fn event_cb, void *data,
 	const struct timespec *period, unsigned int cycle_num)
 {
 	faux_eloop_context_t *context = NULL;

+ 2 - 2
faux/eloop/private.h

@@ -7,7 +7,7 @@
 
 struct faux_eloop_s {
 	bool_t working; // Is event loop active now. Can detect nested loop.
-	faux_eloop_cb_f default_event_cb; // Default callback function
+	faux_eloop_cb_fn default_event_cb; // Default callback function
 	faux_sched_t *sched; // Service shed structure
 	faux_list_t *fds; // List of registered file descriptors
 	faux_pollfd_t *pollfds; // Service object for ppoll()
@@ -21,7 +21,7 @@ struct faux_eloop_s {
 
 
 typedef struct faux_eloop_context_s {
-	faux_eloop_cb_f event_cb;
+	faux_eloop_cb_fn event_cb;
 	void *user_data;
 } faux_eloop_context_t;