Skip to content
Snippets Groups Projects
Commit 5f3d352a authored by Simon McVittie's avatar Simon McVittie
Browse files

Merge branch 'older-glibs' into 'master'

Build successfully on GLib 2.32

See merge request GNOME/libglnx!7
parents 9d0711fe 3063c695
No related branches found
No related tags found
No related merge requests found
...@@ -49,7 +49,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContext, g_main_context_unref) ...@@ -49,7 +49,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContext, g_main_context_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainLoop, g_main_loop_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainLoop, g_main_loop_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSource, g_source_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSource, g_source_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMappedFile, g_mapped_file_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMappedFile, g_mapped_file_unref)
#if GLIB_CHECK_VERSION(2, 36, 0)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMarkupParseContext, g_markup_parse_context_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMarkupParseContext, g_markup_parse_context_unref)
#endif
G_DEFINE_AUTOPTR_CLEANUP_FUNC(gchar, g_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(gchar, g_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNode, g_node_destroy) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNode, g_node_destroy)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionContext, g_option_context_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionContext, g_option_context_free)
...@@ -75,11 +77,15 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariant, g_variant_unref) ...@@ -75,11 +77,15 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariant, g_variant_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantBuilder, g_variant_builder_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantBuilder, g_variant_builder_unref)
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantBuilder, g_variant_builder_clear) G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantBuilder, g_variant_builder_clear)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantIter, g_variant_iter_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantIter, g_variant_iter_free)
#if GLIB_CHECK_VERSION(2, 40, 0)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantDict, g_variant_dict_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantDict, g_variant_dict_unref)
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear) G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear)
#endif
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantType, g_variant_type_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantType, g_variant_type_free)
#if GLIB_CHECK_VERSION(2, 40, 0)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSubprocess, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSubprocess, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSubprocessLauncher, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSubprocessLauncher, g_object_unref)
#endif
/* Add GObject-based types as needed. */ /* Add GObject-based types as needed. */
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncResult, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncResult, g_object_unref)
...@@ -101,7 +107,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMount, g_object_unref) ...@@ -101,7 +107,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMount, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOutputStream, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOutputStream, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocket, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocket, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketAddress, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketAddress, g_object_unref)
#if GLIB_CHECK_VERSION(2, 36, 0)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTask, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTask, g_object_unref)
#endif
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsCertificate, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsCertificate, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsDatabase, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsDatabase, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsInteraction, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsInteraction, g_object_unref)
......
...@@ -27,6 +27,26 @@ ...@@ -27,6 +27,26 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#if !GLIB_CHECK_VERSION(2, 34, 0)
#define g_clear_pointer(pp, destroy) \
G_STMT_START { \
G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer)); \
/* Only one access, please; work around type aliasing */ \
union { char *in; gpointer *out; } _pp; \
gpointer _p; \
/* This assignment is needed to avoid a gcc warning */ \
GDestroyNotify _destroy = (GDestroyNotify) (destroy); \
\
_pp.in = (char *) (pp); \
_p = *_pp.out; \
if (_p) \
{ \
*_pp.out = NULL; \
_destroy (_p); \
} \
} G_STMT_END
#endif
#if !GLIB_CHECK_VERSION(2, 44, 0) #if !GLIB_CHECK_VERSION(2, 44, 0)
#define g_strv_contains glnx_strv_contains #define g_strv_contains glnx_strv_contains
...@@ -43,4 +63,16 @@ gboolean glnx_set_object (GObject **object_ptr, ...@@ -43,4 +63,16 @@ gboolean glnx_set_object (GObject **object_ptr,
#endif /* !GLIB_CHECK_VERSION(2, 44, 0) */ #endif /* !GLIB_CHECK_VERSION(2, 44, 0) */
#ifndef g_assert_nonnull
#define g_assert_nonnull(x) g_assert (x != NULL)
#endif
#ifndef g_assert_null
#define g_assert_null(x) g_assert (x == NULL)
#endif
#if !GLIB_CHECK_VERSION (2, 38, 0)
#define g_test_skip(s) g_test_message ("SKIP: %s", s)
#endif
G_END_DECLS G_END_DECLS
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <glnx-errors.h> #include <glnx-errors.h>
#include <glnx-xattrs.h> #include <glnx-xattrs.h>
#include <glnx-backport-autoptr.h> #include <glnx-backport-autoptr.h>
#include <glnx-backports.h>
#include <glnx-local-alloc.h> #include <glnx-local-alloc.h>
#include <glnx-missing.h> #include <glnx-missing.h>
......
...@@ -218,7 +218,11 @@ test_xattr_races (void) ...@@ -218,7 +218,11 @@ test_xattr_races (void)
/* FIXME - this deadlocks for me on 4.9.4-201.fc25.x86_64, whether /* FIXME - this deadlocks for me on 4.9.4-201.fc25.x86_64, whether
* using overlayfs or xfs as source/dest. * using overlayfs or xfs as source/dest.
*/ */
#if GLIB_CHECK_VERSION (2, 36, 0)
const guint nprocs = MAX (4, g_get_num_processors ()); const guint nprocs = MAX (4, g_get_num_processors ());
#else
const guint nprocs = 4;
#endif
struct XattrWorker wdata[nprocs]; struct XattrWorker wdata[nprocs];
GThread *threads[nprocs]; GThread *threads[nprocs];
g_autoptr(GError) local_error = NULL; g_autoptr(GError) local_error = NULL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment