commit a13ba1946f37034879ba7e398ca39e4697e6d200
parent fbe1c835b2b02a96baf7e88527a3fa6ee070234e
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Fri, 25 Jul 2025 13:37:05 +0200
mhd_atomic_counter.h: fixed code style
Diffstat:
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/src/mhd2/mhd_atomic_counter.h b/src/mhd2/mhd_atomic_counter.h
@@ -48,7 +48,7 @@
#ifdef MHD_SUPPORT_THREADS
-# if defined(MHD_SUPPORT_ATOMIC_COUNTERS) && !defined(__STDC_NO_ATOMICS__)
+# if defined(MHD_SUPPORT_ATOMIC_COUNTERS) && ! defined(__STDC_NO_ATOMICS__)
/**
* Atomic operations are based native compiler support for atomics
@@ -130,7 +130,7 @@ struct mhd_AtomicCounter
* already.
*/
# define mhd_atomic_counter_init(pcnt,initial_value) \
- (atomic_init (&((pcnt)->count), (initial_value)), (! 0))
+ (atomic_init (&((pcnt)->count), (initial_value)), (! 0))
/**
* Deinitialise the counter.
@@ -143,25 +143,27 @@ struct mhd_AtomicCounter
* Atomically increment the value of the counter
* @param pcnt the pointer to the counter to increment
*/
-# define mhd_atomic_counter_inc(pcnt) \
- do { atomic_fetch_add_explicit(&((pcnt)->count), 1, \
- memory_order_relaxed); } while (0)
+# define mhd_atomic_counter_inc(pcnt) \
+ do { atomic_fetch_add_explicit (&((pcnt)->count), 1, \
+ memory_order_relaxed); } while (0)
/**
* Atomically increment the value of the counter and return the result
* @param pcnt the pointer to the counter to increment
* @return the final/resulting counter value
*/
-# define mhd_atomic_counter_inc_get(pcnt) \
- (atomic_fetch_add_explicit(&((pcnt)->count), 1, memory_order_relaxed) + 1)
+# define mhd_atomic_counter_inc_get(pcnt) \
+ (atomic_fetch_add_explicit (&((pcnt)->count), \
+ 1, memory_order_relaxed) + 1)
/**
* Atomically decrement the value of the counter and return the result
* @param pcnt the pointer to the counter to decrement
* @return the final/resulting counter value
*/
-# define mhd_atomic_counter_dec_get(pcnt) \
- (atomic_fetch_sub_explicit(&((pcnt)->count), 1, memory_order_release) - 1)
+# define mhd_atomic_counter_dec_get(pcnt) \
+ (atomic_fetch_sub_explicit (&((pcnt)->count), \
+ 1, memory_order_release) - 1)
/**
* Atomically get the value of the counter
@@ -169,7 +171,7 @@ struct mhd_AtomicCounter
* @return the counter value
*/
# define mhd_atomic_counter_get(pcnt) \
- (atomic_load_explicit(&((pcnt)->count), memory_order_relaxed))
+ (atomic_load_explicit (&((pcnt)->count), memory_order_relaxed))
/**
* Atomically increment the value of the counter and return the result.
@@ -178,7 +180,7 @@ struct mhd_AtomicCounter
* @return the final/resulting counter value
*/
# define mhd_atomic_counter_inc_wrap_get(pcnt) \
- mhd_atomic_counter_inc_get (pcnt)
+ mhd_atomic_counter_inc_get (pcnt)
#elif defined(mhd_ATOMIC_BY_LOCKS)
/**
@@ -190,8 +192,8 @@ struct mhd_AtomicCounter
* already.
*/
# define mhd_atomic_counter_init(pcnt,initial_value) \
- ((pcnt)->count = (initial_value), \
- mhd_mutex_init_short (&((pcnt)->lock)))
+ ((pcnt)->count = (initial_value), \
+ mhd_mutex_init_short (&((pcnt)->lock)))
/**
* Deinitialise the counter.
@@ -199,7 +201,7 @@ struct mhd_AtomicCounter
* @warning Must be called only for the counters that has been initialised.
*/
# define mhd_atomic_counter_deinit(pcnt) \
- mhd_mutex_destroy_chk (&((pcnt)->lock))
+ mhd_mutex_destroy_chk (&((pcnt)->lock))
/**
* Atomically increment the value of the counter
@@ -265,7 +267,7 @@ mhd_atomic_counter_get (struct mhd_AtomicCounter *pcnt);
* already.
*/
# define mhd_atomic_counter_init(pcnt,initial_value) \
- ((pcnt)->count = (initial_value), (! 0))
+ ((pcnt)->count = (initial_value), (! 0))
/**
* Deinitialise the counter.
@@ -308,7 +310,7 @@ mhd_atomic_counter_get (struct mhd_AtomicCounter *pcnt);
* @return the final/resulting counter value
*/
# define mhd_atomic_counter_inc_wrap_get(pcnt) \
- mhd_atomic_counter_inc_get (pcnt)
+ mhd_atomic_counter_inc_get (pcnt)
#endif /* mhd_ATOMIC_SINGLE_THREAD */