core: Compile again on GLib 2.28

This commit is contained in:
Colin Walters 2012-05-05 11:21:45 -04:00
parent 471c04605e
commit 38dd179017
6 changed files with 30 additions and 15 deletions

View File

@ -183,7 +183,7 @@ do_op_overlay (OstreeDaemon *self,
tdata->op = op;
tdata->dir = ot_gfile_new_for_path (dir);
#if GLIB_CHECK_VERSION(2,32,0)
#if GLIB_CHECK_VERSION(2,32,0) && !defined(OSTREE_GLIB_TARGET_MIN)
g_thread_new ("overlay-dir-thread", overlay_dir_thread, tdata);
#else
g_thread_create_full (overlay_dir_thread, tdata, 0, FALSE, FALSE,

View File

@ -74,7 +74,11 @@ struct _OstreeRepoPrivate {
GFile *remote_cache_dir;
GFile *config_file;
#if GLIB_CHECK_VERSION(2,32,0) && !defined(OSTREE_GLIB_TARGET_MIN)
GMutex cache_lock;
#else
GMutex *cache_lock;
#endif
GPtrArray *cached_meta_indexes;
GPtrArray *cached_content_indexes;
GHashTable *cached_pack_index_mappings;
@ -115,7 +119,7 @@ ostree_repo_finalize (GObject *object)
ot_clear_ptrarray (&priv->cached_content_indexes);
g_hash_table_destroy (priv->cached_pack_index_mappings);
g_hash_table_destroy (priv->cached_pack_data_mappings);
g_mutex_clear (&priv->cache_lock);
ot_mutex_free (priv->cache_lock);
G_OBJECT_CLASS (ostree_repo_parent_class)->finalize (object);
}
@ -216,7 +220,7 @@ ostree_repo_init (OstreeRepo *self)
{
OstreeRepoPrivate *priv = GET_PRIVATE (self);
g_mutex_init (&priv->cache_lock);
ot_mutex_init (priv->cache_lock);
priv->cached_pack_index_mappings = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free,
(GDestroyNotify)g_variant_unref);
@ -1929,7 +1933,7 @@ ostree_repo_list_pack_indexes (OstreeRepo *self,
ot_lptrarray GPtrArray *ret_meta_indexes = NULL;
ot_lptrarray GPtrArray *ret_data_indexes = NULL;
g_mutex_lock (&priv->cache_lock);
ot_mutex_lock (priv->cache_lock);
if (priv->cached_meta_indexes)
{
ret_meta_indexes = g_ptr_array_ref (priv->cached_meta_indexes);
@ -1960,7 +1964,7 @@ ostree_repo_list_pack_indexes (OstreeRepo *self,
ot_transfer_out_value (out_meta_indexes, &ret_meta_indexes);
ot_transfer_out_value (out_data_indexes, &ret_data_indexes);
out:
g_mutex_unlock (&priv->cache_lock);
ot_mutex_unlock (priv->cache_lock);
return ret;
}
@ -3404,7 +3408,7 @@ ostree_repo_load_pack_index (OstreeRepo *self,
ot_lvariant GVariant *ret_variant = NULL;
ot_lobj GFile *path = NULL;
g_mutex_lock (&priv->cache_lock);
ot_mutex_lock (priv->cache_lock);
ret_variant = g_hash_table_lookup (priv->cached_pack_index_mappings, pack_checksum);
if (ret_variant)
@ -3427,7 +3431,7 @@ ostree_repo_load_pack_index (OstreeRepo *self,
ret = TRUE;
ot_transfer_out_value (out_variant, &ret_variant);
out:
g_mutex_unlock (&priv->cache_lock);
ot_mutex_unlock (priv->cache_lock);
return ret;
}
@ -3454,7 +3458,7 @@ ostree_repo_map_pack_file (OstreeRepo *self,
GMappedFile *map = NULL;
ot_lobj GFile *path = NULL;
g_mutex_lock (&priv->cache_lock);
ot_mutex_lock (priv->cache_lock);
map = g_hash_table_lookup (priv->cached_pack_data_mappings, pack_checksum);
if (map == NULL)
@ -3478,7 +3482,7 @@ ostree_repo_map_pack_file (OstreeRepo *self,
if (out_len)
*out_len = ret_len;
out:
g_mutex_unlock (&priv->cache_lock);
ot_mutex_unlock (priv->cache_lock);
return ret;
}

View File

@ -28,7 +28,7 @@
#include "otutil.h"
#if GLIB_CHECK_VERSION(2,32,0)
#if GLIB_CHECK_VERSION(2,32,0) && !defined(OSTREE_GLIB_TARGET_MIN)
/* nothing */
#else
/* Code copied from glib/glib/genviron.c */

View File

@ -27,10 +27,16 @@
G_BEGIN_DECLS
#if GLIB_CHECK_VERSION(2,32,0)
#if GLIB_CHECK_VERSION(2,32,0) && !defined(OSTREE_GLIB_TARGET_MIN)
#define ot_g_environ_getenv g_environ_getenv
#define ot_g_environ_setenv g_environ_setenv
#define ot_g_environ_unsetenv g_environ_unsetenv
#define ot_mutex_init(v) do { g_mutex_init (&(v)); } while (0);
#define ot_mutex_free(v) do { g_mutex_clear (&(v)); } while (0);
#define ot_mutex_lock(v) do { g_mutex_lock (&(v)); } while (0);
#define ot_mutex_unlock(v) do { g_mutex_unlock (&(v)); } while (0);
#else
const gchar *
ot_g_environ_getenv (gchar **envp,
@ -45,6 +51,11 @@ ot_g_environ_setenv (gchar **envp,
gchar **
ot_g_environ_unsetenv (gchar **envp,
const gchar *variable);
#define ot_mutex_init(v) do { v = g_mutex_new (); } while (0);
#define ot_mutex_free(v) do { g_mutex_free (v); } while (0);
#define ot_mutex_lock(v) do { g_mutex_lock (v); } while (0);
#define ot_mutex_unlock(v) do { g_mutex_unlock (v); } while (0);
#endif

View File

@ -91,7 +91,7 @@ ot_util_variant_save (GFile *dest,
GVariant *
ot_util_variant_take_ref (GVariant *variant)
{
#if GLIB_CHECK_VERSION(2,32,0)
#if GLIB_CHECK_VERSION(2,32,0) && !defined(OSTREE_GLIB_TARGET_MIN)
return g_variant_take_ref (variant);
#else
if (g_variant_is_floating (variant))

View File

@ -106,6 +106,7 @@ ostree_builtin_config (int argc, char **argv, GFile *repo_path, GError **error)
}
else if (!strcmp (op, "set"))
{
GKeyFile *readonly_config = NULL;
ot_lfree char *value = NULL;
if (argc < 3)
{
@ -119,9 +120,8 @@ ostree_builtin_config (int argc, char **argv, GFile *repo_path, GError **error)
if (!split_key_string (section_key, &section, &key, error))
goto out;
config = g_key_file_ref (ostree_repo_get_config (repo));
value = g_key_file_get_string (config, section, key, error);
readonly_config = ostree_repo_get_config (repo);
value = g_key_file_get_string (readonly_config, section, key, error);
if (value == NULL)
goto out;