[Tarantool-patches] [PATCH 09/22] fiber: use void for empty args

Cyrill Gorcunov gorcunov at gmail.com
Fri Jul 3 17:45:13 MSK 2020


Part-of #4718

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 src/lib/core/fiber.c         | 18 +++++++++---------
 src/lib/core/fiber.h         | 18 +++++++++---------
 src/lib/core/fiber_channel.c |  2 +-
 src/lib/core/fiber_channel.h |  2 +-
 src/lib/core/fiber_cond.c    |  2 +-
 src/lib/core/fiber_pool.c    |  4 ++--
 6 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/src/lib/core/fiber.c b/src/lib/core/fiber.c
index 5389ce467..483ae3ce1 100644
--- a/src/lib/core/fiber.c
+++ b/src/lib/core/fiber.c
@@ -303,7 +303,7 @@ fiber_attr_create(struct fiber_attr *fiber_attr)
 }
 
 struct fiber_attr *
-fiber_attr_new()
+fiber_attr_new(void)
 {
 	struct fiber_attr *fiber_attr = malloc(sizeof(*fiber_attr));
 	if (fiber_attr == NULL)  {
@@ -432,7 +432,7 @@ fiber_start(struct fiber *callee, ...)
 }
 
 bool
-fiber_checkstack()
+fiber_checkstack(void)
 {
 	return false;
 }
@@ -551,7 +551,7 @@ fiber_set_cancellable(bool yesno)
 }
 
 bool
-fiber_is_cancelled()
+fiber_is_cancelled(void)
 {
 	return fiber()->flags & FIBER_IS_CANCELLED;
 }
@@ -805,7 +805,7 @@ unregister_fid(struct fiber *fiber)
 }
 
 struct fiber *
-fiber_self()
+fiber_self(void)
 {
 	return fiber();
 }
@@ -1316,20 +1316,20 @@ loop_on_iteration_end(ev_loop *loop, ev_prepare *watcher, int revents)
 }
 
 static inline void
-fiber_top_init()
+fiber_top_init(void)
 {
 	ev_prepare_init(&cord()->prepare_event, loop_on_iteration_end);
 	ev_check_init(&cord()->check_event, loop_on_iteration_start);
 }
 
 bool
-fiber_top_is_enabled()
+fiber_top_is_enabled(void)
 {
 	return fiber_top_enabled;
 }
 
 inline void
-fiber_top_enable()
+fiber_top_enable(void)
 {
 	if (!fiber_top_enabled) {
 		ev_prepare_start(cord()->loop, &cord()->prepare_event);
@@ -1348,7 +1348,7 @@ fiber_top_enable()
 }
 
 inline void
-fiber_top_disable()
+fiber_top_disable(void)
 {
 	if (fiber_top_enabled) {
 		ev_prepare_stop(cord()->loop, &cord()->prepare_event);
@@ -1702,7 +1702,7 @@ cord_set_name(const char *name)
 }
 
 bool
-cord_is_main()
+cord_is_main(void)
 {
 	return cord() == &main_cord;
 }
diff --git a/src/lib/core/fiber.h b/src/lib/core/fiber.h
index cd9346a55..fffbe8f8b 100644
--- a/src/lib/core/fiber.h
+++ b/src/lib/core/fiber.h
@@ -179,7 +179,7 @@ struct fiber_attr;
  * will not take ownership.
  */
 API_EXPORT struct fiber_attr *
-fiber_attr_new();
+fiber_attr_new(void);
 
 /**
  * Delete the fiber_attr and free all allocated resources.
@@ -219,7 +219,7 @@ typedef int (*fiber_func)(va_list);
  * Return the current fiber
  */
 API_EXPORT struct fiber *
-fiber_self();
+fiber_self(void);
 
 /**
  * Create a new fiber.
@@ -343,7 +343,7 @@ fiber_sleep(double s);
  * manually).
  */
 API_EXPORT bool
-fiber_is_cancelled();
+fiber_is_cancelled(void);
 
 /**
  * Report loop begin time as double (cheap).
@@ -666,7 +666,7 @@ cord_name(struct cord *cord)
 
 /** True if this cord represents the process main thread. */
 bool
-cord_is_main();
+cord_is_main(void);
 
 void
 fiber_init(int (*fiber_invoke)(fiber_func f, va_list ap));
@@ -689,7 +689,7 @@ fiber_name(struct fiber *f)
 }
 
 bool
-fiber_checkstack();
+fiber_checkstack(void);
 
 /**
  * @brief yield & check for timeout
@@ -699,7 +699,7 @@ bool
 fiber_yield_timeout(ev_tstamp delay);
 
 void
-fiber_destroy_all();
+fiber_destroy_all(struct cord *cord);
 
 void
 fiber_gc(void);
@@ -726,13 +726,13 @@ fiber_stat(fiber_stat_cb cb, void *cb_ctx);
 
 #if ENABLE_FIBER_TOP
 bool
-fiber_top_is_enabled();
+fiber_top_is_enabled(void);
 
 void
-fiber_top_enable();
+fiber_top_enable(void);
 
 void
-fiber_top_disable();
+fiber_top_disable(void);
 #endif /* ENABLE_FIBER_TOP */
 
 /** Useful for C unit tests */
diff --git a/src/lib/core/fiber_channel.c b/src/lib/core/fiber_channel.c
index 4bbff45c5..2ac585648 100644
--- a/src/lib/core/fiber_channel.c
+++ b/src/lib/core/fiber_channel.c
@@ -223,7 +223,7 @@ fiber_channel_delete(struct fiber_channel *ch)
 static __thread struct mempool ipc_value_pool;
 
 struct ipc_value *
-ipc_value_new()
+ipc_value_new(void)
 {
 	if (! mempool_is_initialized(&ipc_value_pool)) {
 		/*
diff --git a/src/lib/core/fiber_channel.h b/src/lib/core/fiber_channel.h
index 0e64e1459..335324dbc 100644
--- a/src/lib/core/fiber_channel.h
+++ b/src/lib/core/fiber_channel.h
@@ -76,7 +76,7 @@ void
 ipc_value_delete(struct ipc_msg *msg);
 
 struct ipc_value *
-ipc_value_new();
+ipc_value_new(void);
 
 
 /**
diff --git a/src/lib/core/fiber_cond.c b/src/lib/core/fiber_cond.c
index 4998d6494..904a350d9 100644
--- a/src/lib/core/fiber_cond.c
+++ b/src/lib/core/fiber_cond.c
@@ -52,7 +52,7 @@ fiber_cond_destroy(struct fiber_cond *c)
 static __thread struct mempool cond_pool;
 
 struct fiber_cond *
-fiber_cond_new()
+fiber_cond_new(void)
 {
 	struct fiber_cond *cond;
 	if (! mempool_is_initialized(&cond_pool)) {
diff --git a/src/lib/core/fiber_pool.c b/src/lib/core/fiber_pool.c
index d40c9bcc3..b980028e4 100644
--- a/src/lib/core/fiber_pool.c
+++ b/src/lib/core/fiber_pool.c
@@ -46,7 +46,7 @@ fiber_pool_f(va_list ap)
 	pool->size++;
 restart:
 	msg = NULL;
-	while (!stailq_empty(output) && !fiber_is_cancelled(fiber())) {
+	while (!stailq_empty(output) && !fiber_is_cancelled()) {
 		 msg = stailq_shift_entry(output, struct cmsg, fifo);
 
 		if (f->caller == &cord->sched && ! stailq_empty(output) &&
@@ -74,7 +74,7 @@ fiber_pool_f(va_list ap)
 		fiber_on_stop(f);
 	}
 	/** Put the current fiber into a fiber cache. */
-	if (!fiber_is_cancelled(fiber()) && (msg != NULL ||
+	if (!fiber_is_cancelled() && (msg != NULL ||
 	    ev_monotonic_now(loop) - last_active_at < pool->idle_timeout)) {
 		if (msg != NULL)
 			last_active_at = ev_monotonic_now(loop);
-- 
2.26.2



More information about the Tarantool-patches mailing list