[ostree] core: Compile again on GLib 2.28
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] core: Compile again on GLib 2.28
- Date: Sat, 5 May 2012 15:53:16 +0000 (UTC)
commit 38dd1790179bcb748e0263ffec60d76234bd23d5
Author: Colin Walters <walters verbum org>
Date: Sat May 5 11:21:45 2012 -0400
core: Compile again on GLib 2.28
src/daemon/ot-daemon.c | 2 +-
src/libostree/ostree-repo.c | 20 ++++++++++++--------
src/libotutil/ot-glib-compat.c | 2 +-
src/libotutil/ot-glib-compat.h | 13 ++++++++++++-
src/libotutil/ot-variant-utils.c | 2 +-
src/ostree/ot-builtin-config.c | 6 +++---
6 files changed, 30 insertions(+), 15 deletions(-)
---
diff --git a/src/daemon/ot-daemon.c b/src/daemon/ot-daemon.c
index 465b2fd..7ef1b17 100644
--- a/src/daemon/ot-daemon.c
+++ b/src/daemon/ot-daemon.c
@@ -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,
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 948ef91..d13c033 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -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;
}
diff --git a/src/libotutil/ot-glib-compat.c b/src/libotutil/ot-glib-compat.c
index 44181b9..409fc44 100644
--- a/src/libotutil/ot-glib-compat.c
+++ b/src/libotutil/ot-glib-compat.c
@@ -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 */
diff --git a/src/libotutil/ot-glib-compat.h b/src/libotutil/ot-glib-compat.h
index 18d7d3d..1bc1ab6 100644
--- a/src/libotutil/ot-glib-compat.h
+++ b/src/libotutil/ot-glib-compat.h
@@ -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
diff --git a/src/libotutil/ot-variant-utils.c b/src/libotutil/ot-variant-utils.c
index 3932386..b9b8504 100644
--- a/src/libotutil/ot-variant-utils.c
+++ b/src/libotutil/ot-variant-utils.c
@@ -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))
diff --git a/src/ostree/ot-builtin-config.c b/src/ostree/ot-builtin-config.c
index 8ad6a17..c896409 100644
--- a/src/ostree/ot-builtin-config.c
+++ b/src/ostree/ot-builtin-config.c
@@ -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, §ion, &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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]