Merge branch 'wip/smcv/g-steal-fd-old-glib' into 'master'

backports: Avoid warnings for g_steal_fd when targeting older GLib

See merge request GNOME/libglnx!56
This commit is contained in:
Simon McVittie
2024-04-19 09:45:29 +00:00

View File

@@ -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)