Skip to content
This repository was archived by the owner on Aug 26, 2024. It is now read-only.

Commit b6d207b

Browse files
author
jan.kneschke@oracle.com
committed
handle the changed return-type of g_atomic_int_add() from glib-2.30
if we build against < 2.30 assume a return-void, if it is newer assume a return-int
1 parent efd3666 commit b6d207b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/chassis-stats.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ CHASSIS_API GHashTable* chassis_stats_get(chassis_stats_t *user_data);
4141

4242
#define CHASSIS_STATS_ALLOC_INC_NAME(name) ((chassis_global_stats != NULL) ? g_atomic_int_inc(&(chassis_global_stats->name ## _alloc)) : (void)0)
4343
#define CHASSIS_STATS_FREE_INC_NAME(name) ((chassis_global_stats != NULL) ? g_atomic_int_inc(&(chassis_global_stats->name ## _free)) : (void)0)
44+
45+
/* the prototype of g_atomic_int_add() changed in 2.30.0 to
46+
* return a gint instead of nothing (void)
47+
*/
48+
#if GLIB_CHECK_VERSION(2, 30, 0)
4449
#define CHASSIS_STATS_ADD_NAME(name, addme) ((chassis_global_stats != NULL) ? g_atomic_int_add(&(chassis_global_stats->name), addme) : 0)
50+
#else
51+
#define CHASSIS_STATS_ADD_NAME(name, addme) ((chassis_global_stats != NULL) ? g_atomic_int_add(&(chassis_global_stats->name), addme) : (void)0)
52+
#endif
4553
#define CHASSIS_STATS_GET_NAME(name) ((chassis_global_stats != NULL) ? g_atomic_int_get(&(chassis_global_stats->name)) : 0)
4654
#define CHASSIS_STATS_SET_NAME(name, setme) ((chassis_global_stats != NULL) ? g_atomic_int_set(&(chassis_global_stats->name), setme) : (void)0)
4755

0 commit comments

Comments
 (0)