Skip to content

Commit

Permalink
Merge branch 'wip/smcv/g-steal-fd-old-glib' into 'master'
Browse files Browse the repository at this point in the history
backports: Avoid warnings for g_steal_fd when targeting older GLib

See merge request GNOME/libglnx!56
  • Loading branch information
smcv committed Apr 19, 2024
2 parents 202b294 + e31547a commit ed4c1fb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions glnx-backports.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,22 @@ _glnx_memdup2 (gconstpointer mem,
(((a) > (b) ? (a) - (b) : (b) - (a)) < (epsilon))
#endif

#if !GLIB_CHECK_VERSION(2, 70, 0)
#define g_steal_fd _glnx_steal_fd
static inline int
_glnx_steal_fd (int *fdp)
{
#if GLIB_CHECK_VERSION(2, 70, 0)
/* Allow it to be used without deprecation warnings, even if the target
* GLib version is older */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
return g_steal_fd (fdp);
G_GNUC_END_IGNORE_DEPRECATIONS
#else
int fd = *fdp;
*fdp = -1;
return fd;
}
#endif
}
#define g_steal_fd _glnx_steal_fd

#if !GLIB_CHECK_VERSION(2, 74, 0)
#define G_APPLICATION_DEFAULT_FLAGS ((GApplicationFlags) 0)
Expand Down

0 comments on commit ed4c1fb

Please sign in to comment.