mirror of
https://github.com/ostreedev/ostree.git
synced 2025-03-19 22:50:35 +03:00
core: Port libostree to local alloc
This commit is contained in:
parent
87f45052af
commit
8b6bf09d7a
@ -43,7 +43,7 @@ ostree_validate_rev (const char *rev,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GPtrArray *components = NULL;
|
||||
ot_lptrarray GPtrArray *components = NULL;
|
||||
|
||||
if (!ot_util_path_split_validate (rev, &components, error))
|
||||
goto out;
|
||||
@ -57,7 +57,6 @@ ostree_validate_rev (const char *rev,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_ptr_array_unref (components);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -159,12 +158,12 @@ ostree_get_xattrs_for_file (GFile *f,
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
const char *path;
|
||||
GVariant *ret_xattrs = NULL;
|
||||
ssize_t bytes_read;
|
||||
ot_lvariant GVariant *ret_xattrs = NULL;
|
||||
ot_lfree char *xattr_names = NULL;
|
||||
ot_lfree char *xattr_names_canonical = NULL;
|
||||
GVariantBuilder builder;
|
||||
gboolean builder_initialized = FALSE;
|
||||
char *xattr_names = NULL;
|
||||
char *xattr_names_canonical = NULL;
|
||||
ssize_t bytes_read;
|
||||
|
||||
path = ot_gfile_get_path_cached (f);
|
||||
|
||||
@ -203,8 +202,6 @@ ostree_get_xattrs_for_file (GFile *f,
|
||||
out:
|
||||
if (!builder_initialized)
|
||||
g_variant_builder_clear (&builder);
|
||||
g_free (xattr_names);
|
||||
g_free (xattr_names_canonical);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -218,12 +215,12 @@ ostree_checksum_file_from_input (GFileInfo *file_info,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GChecksum *ret_checksum = NULL;
|
||||
GVariant *dirmeta = NULL;
|
||||
GVariant *packed = NULL;
|
||||
guint8 buf[8192];
|
||||
gsize bytes_read;
|
||||
guint32 mode;
|
||||
ot_lvariant GVariant *dirmeta = NULL;
|
||||
ot_lvariant GVariant *packed = NULL;
|
||||
GChecksum *ret_checksum = NULL;
|
||||
|
||||
if (OSTREE_OBJECT_TYPE_IS_META (objtype))
|
||||
return ot_gio_checksum_stream (in, out_checksum, cancellable, error);
|
||||
@ -288,8 +285,6 @@ ostree_checksum_file_from_input (GFileInfo *file_info,
|
||||
ot_transfer_out_value (out_checksum, &ret_checksum);
|
||||
out:
|
||||
ot_clear_checksum (&ret_checksum);
|
||||
ot_clear_gvariant (&dirmeta);
|
||||
ot_clear_gvariant (&packed);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -301,10 +296,10 @@ ostree_checksum_file (GFile *f,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFileInfo *file_info = NULL;
|
||||
ot_lobj GFileInfo *file_info = NULL;
|
||||
ot_lobj GInputStream *in = NULL;
|
||||
ot_lvariant GVariant *xattrs = NULL;
|
||||
GChecksum *ret_checksum = NULL;
|
||||
GInputStream *in = NULL;
|
||||
GVariant *xattrs = NULL;
|
||||
|
||||
if (g_cancellable_set_error_if_cancelled (cancellable, error))
|
||||
return FALSE;
|
||||
@ -335,10 +330,7 @@ ostree_checksum_file (GFile *f,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value(out_checksum, &ret_checksum);
|
||||
out:
|
||||
g_clear_object (&file_info);
|
||||
g_clear_object (&in);
|
||||
ot_clear_checksum(&ret_checksum);
|
||||
ot_clear_gvariant(&xattrs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -480,8 +472,8 @@ ostree_unwrap_metadata (GVariant *container,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariant *ret_variant = NULL;
|
||||
guint32 actual_type;
|
||||
ot_lvariant GVariant *ret_variant = NULL;
|
||||
|
||||
g_variant_get (container, "(uv)",
|
||||
&actual_type, &ret_variant);
|
||||
@ -497,7 +489,6 @@ ostree_unwrap_metadata (GVariant *container,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value (out_variant, &ret_variant);
|
||||
out:
|
||||
ot_clear_gvariant (&ret_variant);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -508,8 +499,8 @@ ostree_map_metadata_file (GFile *file,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariant *ret_variant = NULL;
|
||||
GVariant *container = NULL;
|
||||
ot_lvariant GVariant *ret_variant = NULL;
|
||||
ot_lvariant GVariant *container = NULL;
|
||||
|
||||
if (!ot_util_variant_map (file, OSTREE_SERIALIZED_VARIANT_FORMAT,
|
||||
&container, error))
|
||||
@ -526,8 +517,6 @@ ostree_map_metadata_file (GFile *file,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value(out_variant, &ret_variant);
|
||||
out:
|
||||
ot_clear_gvariant (&ret_variant);
|
||||
ot_clear_gvariant (&container);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -786,10 +775,10 @@ ostree_parse_archived_file_meta (GVariant *metadata,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFileInfo *ret_file_info = NULL;
|
||||
GVariant *ret_xattrs = NULL;
|
||||
guint32 version, uid, gid, mode, rdev;
|
||||
const char *symlink_target;
|
||||
ot_lobj GFileInfo *ret_file_info = NULL;
|
||||
ot_lvariant GVariant *ret_xattrs = NULL;
|
||||
|
||||
g_variant_get (metadata, "(uuuuu&s@a(ayay))",
|
||||
&version, &uid, &gid, &mode, &rdev,
|
||||
@ -842,8 +831,6 @@ ostree_parse_archived_file_meta (GVariant *metadata,
|
||||
ot_transfer_out_value(out_file_info, &ret_file_info);
|
||||
ot_transfer_out_value(out_xattrs, &ret_xattrs);
|
||||
out:
|
||||
g_clear_object (&ret_file_info);
|
||||
ot_clear_gvariant (&ret_xattrs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -857,13 +844,13 @@ ostree_create_file_from_input (GFile *dest_file,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
const char *dest_path;
|
||||
gboolean ret = FALSE;
|
||||
GFileOutputStream *out = NULL;
|
||||
const char *dest_path;
|
||||
guint32 uid, gid, mode;
|
||||
GChecksum *ret_checksum = NULL;
|
||||
gboolean is_meta;
|
||||
gboolean is_archived_content;
|
||||
ot_lobj GFileOutputStream *out = NULL;
|
||||
GChecksum *ret_checksum = NULL;
|
||||
|
||||
is_meta = OSTREE_OBJECT_TYPE_IS_META (objtype);
|
||||
is_archived_content = objtype == OSTREE_OBJECT_TYPE_ARCHIVED_FILE_CONTENT;
|
||||
@ -1008,7 +995,6 @@ ostree_create_file_from_input (GFile *dest_file,
|
||||
(void) unlink (dest_path);
|
||||
}
|
||||
ot_clear_checksum (&ret_checksum);
|
||||
g_clear_object (&out);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1066,12 +1052,12 @@ ostree_create_temp_file_from_input (GFile *dir,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GChecksum *ret_checksum = NULL;
|
||||
GString *tmp_name = NULL;
|
||||
char *possible_name = NULL;
|
||||
GFile *possible_file = NULL;
|
||||
GError *temp_error = NULL;
|
||||
int i = 0;
|
||||
ot_lfree char *possible_name = NULL;
|
||||
ot_lobj GFile *possible_file = NULL;
|
||||
GChecksum *ret_checksum = NULL;
|
||||
GString *tmp_name = NULL;
|
||||
|
||||
tmp_name = create_tmp_string (ot_gfile_get_path_cached (dir),
|
||||
prefix, suffix);
|
||||
@ -1121,8 +1107,6 @@ ostree_create_temp_file_from_input (GFile *dir,
|
||||
out:
|
||||
if (tmp_name)
|
||||
g_string_free (tmp_name, TRUE);
|
||||
g_free (possible_name);
|
||||
g_clear_object (&possible_file);
|
||||
ot_clear_checksum (&ret_checksum);
|
||||
return ret;
|
||||
}
|
||||
@ -1137,8 +1121,8 @@ ostree_create_temp_regular_file (GFile *dir,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFile *ret_file = NULL;
|
||||
GOutputStream *ret_stream = NULL;
|
||||
ot_lobj GFile *ret_file = NULL;
|
||||
ot_lobj GOutputStream *ret_stream = NULL;
|
||||
|
||||
if (!ostree_create_temp_file_from_input (dir, prefix, suffix, NULL, NULL, NULL,
|
||||
OSTREE_OBJECT_TYPE_RAW_FILE, &ret_file,
|
||||
@ -1153,8 +1137,6 @@ ostree_create_temp_regular_file (GFile *dir,
|
||||
ot_transfer_out_value(out_file, &ret_file);
|
||||
ot_transfer_out_value(out_stream, &ret_stream);
|
||||
out:
|
||||
g_clear_object (&ret_file);
|
||||
g_clear_object (&ret_stream);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1168,10 +1150,10 @@ ostree_create_temp_hardlink (GFile *dir,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GString *tmp_name = NULL;
|
||||
char *possible_name = NULL;
|
||||
GFile *possible_file = NULL;
|
||||
int i = 0;
|
||||
ot_lfree char *possible_name = NULL;
|
||||
ot_lobj GFile *possible_file = NULL;
|
||||
GString *tmp_name = NULL;
|
||||
|
||||
tmp_name = create_tmp_string (ot_gfile_get_path_cached (dir),
|
||||
prefix, suffix);
|
||||
@ -1214,8 +1196,6 @@ ostree_create_temp_hardlink (GFile *dir,
|
||||
out:
|
||||
if (tmp_name)
|
||||
g_string_free (tmp_name, TRUE);
|
||||
g_free (possible_name);
|
||||
g_clear_object (&possible_file);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1229,10 +1209,10 @@ ostree_read_pack_entry_raw (guchar *pack_data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariant *ret_entry = NULL;
|
||||
guint64 entry_start;
|
||||
guint64 entry_end;
|
||||
guint32 entry_len;
|
||||
ot_lvariant GVariant *ret_entry = NULL;
|
||||
|
||||
if (G_UNLIKELY (!(offset <= pack_len)))
|
||||
{
|
||||
@ -1277,7 +1257,6 @@ ostree_read_pack_entry_raw (guchar *pack_data,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value (out_entry, &ret_entry);
|
||||
out:
|
||||
ot_clear_gvariant (&ret_entry);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1330,10 +1309,10 @@ ostree_read_pack_entry_variant (GVariant *pack_entry,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GInputStream *stream = NULL;
|
||||
GVariant *container_variant = NULL;
|
||||
GVariant *ret_variant = NULL;
|
||||
guint32 actual_type;
|
||||
ot_lobj GInputStream *stream = NULL;
|
||||
ot_lvariant GVariant *container_variant = NULL;
|
||||
ot_lvariant GVariant *ret_variant = NULL;
|
||||
|
||||
stream = ostree_read_pack_entry_as_stream (pack_entry);
|
||||
|
||||
@ -1356,9 +1335,6 @@ ostree_read_pack_entry_variant (GVariant *pack_entry,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value (out_variant, &ret_variant);
|
||||
out:
|
||||
g_clear_object (&stream);
|
||||
ot_clear_gvariant (&ret_variant);
|
||||
ot_clear_gvariant (&container_variant);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1369,10 +1345,10 @@ ostree_pack_index_search (GVariant *index,
|
||||
guint64 *out_offset)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariant *index_contents;
|
||||
gsize imax, imin;
|
||||
gsize n;
|
||||
guint32 target_objtype;
|
||||
ot_lvariant GVariant *index_contents = NULL;
|
||||
|
||||
index_contents = g_variant_get_child_value (index, 2);
|
||||
|
||||
@ -1427,7 +1403,6 @@ ostree_pack_index_search (GVariant *index,
|
||||
}
|
||||
|
||||
out:
|
||||
ot_clear_gvariant (&index_contents);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1550,10 +1525,10 @@ ostree_validate_structureof_dirtree (GVariant *dirtree,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariantIter *contents_iter = NULL;
|
||||
const char *filename;
|
||||
const char *meta_checksum;
|
||||
const char *content_checksum;
|
||||
GVariantIter *contents_iter = NULL;
|
||||
|
||||
if (!validate_variant (dirtree, OSTREE_TREE_GVARIANT_FORMAT, error))
|
||||
goto out;
|
||||
@ -1668,10 +1643,10 @@ ostree_validate_structureof_pack_index (GVariant *index,
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
const char *header;
|
||||
GVariantIter *content_iter = NULL;
|
||||
guint32 objtype;
|
||||
GVariant *csum_bytes = NULL;
|
||||
guint64 offset;
|
||||
ot_lvariant GVariant *csum_bytes = NULL;
|
||||
GVariantIter *content_iter = NULL;
|
||||
|
||||
if (!validate_variant (index, OSTREE_PACK_INDEX_VARIANT_FORMAT, error))
|
||||
goto out;
|
||||
@ -1701,7 +1676,6 @@ ostree_validate_structureof_pack_index (GVariant *index,
|
||||
out:
|
||||
if (content_iter)
|
||||
g_variant_iter_free (content_iter);
|
||||
ot_clear_gvariant (&csum_bytes);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1711,8 +1685,8 @@ ostree_validate_structureof_pack_superindex (GVariant *superindex,
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
const char *header;
|
||||
GVariant *csum_bytes = NULL;
|
||||
GVariant *bloom = NULL;
|
||||
ot_lvariant GVariant *csum_bytes = NULL;
|
||||
ot_lvariant GVariant *bloom = NULL;
|
||||
GVariantIter *content_iter = NULL;
|
||||
|
||||
if (!validate_variant (superindex, OSTREE_PACK_SUPER_INDEX_VARIANT_FORMAT, error))
|
||||
@ -1741,7 +1715,5 @@ ostree_validate_structureof_pack_superindex (GVariant *superindex,
|
||||
out:
|
||||
if (content_iter)
|
||||
g_variant_iter_free (content_iter);
|
||||
ot_clear_gvariant (&csum_bytes);
|
||||
ot_clear_gvariant (&bloom);
|
||||
return ret;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ ostree_mutable_tree_ensure_dir (OstreeMutableTree *self,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
OstreeMutableTree *ret_dir = NULL;
|
||||
ot_lobj OstreeMutableTree *ret_dir = NULL;
|
||||
|
||||
g_return_val_if_fail (name != NULL, FALSE);
|
||||
|
||||
@ -188,7 +188,6 @@ ostree_mutable_tree_ensure_dir (OstreeMutableTree *self,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value (out_subdir, &ret_dir);
|
||||
out:
|
||||
g_clear_object (&ret_dir);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -200,8 +199,8 @@ ostree_mutable_tree_lookup (OstreeMutableTree *self,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
OstreeMutableTree *ret_subdir = NULL;
|
||||
char *ret_file_checksum = NULL;
|
||||
ot_lobj OstreeMutableTree *ret_subdir = NULL;
|
||||
ot_lfree char *ret_file_checksum = NULL;
|
||||
|
||||
ret_subdir = ot_gobject_refz (g_hash_table_lookup (self->subdirs, name));
|
||||
if (!ret_subdir)
|
||||
@ -218,8 +217,6 @@ ostree_mutable_tree_lookup (OstreeMutableTree *self,
|
||||
ot_transfer_out_value (out_file_checksum, &ret_file_checksum);
|
||||
ot_transfer_out_value (out_subdir, &ret_subdir);
|
||||
out:
|
||||
g_free (ret_file_checksum);
|
||||
g_clear_object (&ret_subdir);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -232,8 +229,8 @@ ostree_mutable_tree_ensure_parent_dirs (OstreeMutableTree *self,
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
int i;
|
||||
OstreeMutableTree *ret_parent = NULL;
|
||||
OstreeMutableTree *subdir = self;
|
||||
OstreeMutableTree *subdir = self; /* nofree */
|
||||
ot_lobj OstreeMutableTree *ret_parent = NULL;
|
||||
|
||||
g_assert (metadata_checksum != NULL);
|
||||
|
||||
@ -268,7 +265,6 @@ ostree_mutable_tree_ensure_parent_dirs (OstreeMutableTree *self,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value (out_parent, &ret_parent);
|
||||
out:
|
||||
g_clear_object (&ret_parent);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -146,11 +146,11 @@ do_resolve_commit (OstreeRepoFile *self,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariant *commit = NULL;
|
||||
GVariant *root_contents = NULL;
|
||||
GVariant *root_metadata = NULL;
|
||||
const char *tree_contents_checksum;
|
||||
const char *tree_meta_checksum;
|
||||
ot_lvariant GVariant *commit = NULL;
|
||||
ot_lvariant GVariant *root_contents = NULL;
|
||||
ot_lvariant GVariant *root_metadata = NULL;
|
||||
|
||||
g_assert (self->parent == NULL);
|
||||
|
||||
@ -181,9 +181,6 @@ do_resolve_commit (OstreeRepoFile *self,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
ot_clear_gvariant (&commit);
|
||||
ot_clear_gvariant (&root_metadata);
|
||||
ot_clear_gvariant (&root_contents);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -192,11 +189,11 @@ do_resolve_nonroot (OstreeRepoFile *self,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariant *container = NULL;
|
||||
GVariant *tree_contents = NULL;
|
||||
GVariant *tree_metadata = NULL;
|
||||
gboolean is_dir;
|
||||
int i;
|
||||
ot_lvariant GVariant *container = NULL;
|
||||
ot_lvariant GVariant *tree_contents = NULL;
|
||||
ot_lvariant GVariant *tree_metadata = NULL;
|
||||
|
||||
i = ostree_repo_file_tree_find_child (self->parent, self->name, &is_dir, &container);
|
||||
|
||||
@ -245,9 +242,6 @@ do_resolve_nonroot (OstreeRepoFile *self,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
ot_clear_gvariant (&container);
|
||||
ot_clear_gvariant (&tree_metadata);
|
||||
ot_clear_gvariant (&tree_contents);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -294,9 +288,9 @@ ostree_repo_file_get_xattrs (OstreeRepoFile *self,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariant *ret_xattrs = NULL;
|
||||
GVariant *metadata = NULL;
|
||||
GFile *local_file = NULL;
|
||||
ot_lvariant GVariant *ret_xattrs = NULL;
|
||||
ot_lvariant GVariant *metadata = NULL;
|
||||
ot_lobj GFile *local_file = NULL;
|
||||
|
||||
if (!ostree_repo_file_ensure_resolved (self, error))
|
||||
goto out;
|
||||
@ -324,9 +318,6 @@ ostree_repo_file_get_xattrs (OstreeRepoFile *self,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value(out_xattrs, &ret_xattrs);
|
||||
out:
|
||||
ot_clear_gvariant (&ret_xattrs);
|
||||
ot_clear_gvariant (&metadata);
|
||||
g_clear_object (&local_file);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -698,8 +689,8 @@ query_child_info_dir (OstreeRepo *repo,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFileInfo *ret_info = NULL;
|
||||
GVariant *metadata = NULL;
|
||||
ot_lobj GFileInfo *ret_info = NULL;
|
||||
ot_lvariant GVariant *metadata = NULL;
|
||||
|
||||
ret_info = g_file_info_new ();
|
||||
|
||||
@ -822,14 +813,14 @@ ostree_repo_file_tree_query_child (OstreeRepoFile *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
const char *name = NULL;
|
||||
gboolean ret = FALSE;
|
||||
GFileInfo *ret_info = NULL;
|
||||
GVariant *files_variant = NULL;
|
||||
GVariant *dirs_variant = NULL;
|
||||
GVariant *tree_child_metadata = NULL;
|
||||
GFileAttributeMatcher *matcher = NULL;
|
||||
const char *name = NULL;
|
||||
int c;
|
||||
ot_lobj GFileInfo *ret_info = NULL;
|
||||
ot_lvariant GVariant *files_variant = NULL;
|
||||
ot_lvariant GVariant *dirs_variant = NULL;
|
||||
ot_lvariant GVariant *tree_child_metadata = NULL;
|
||||
GFileAttributeMatcher *matcher = NULL;
|
||||
|
||||
if (!ostree_repo_file_ensure_resolved (self, error))
|
||||
goto out;
|
||||
@ -890,12 +881,8 @@ ostree_repo_file_tree_query_child (OstreeRepoFile *self,
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value(out_info, &ret_info);
|
||||
out:
|
||||
g_clear_object (&ret_info);
|
||||
if (matcher)
|
||||
g_file_attribute_matcher_unref (matcher);
|
||||
ot_clear_gvariant (&tree_child_metadata);
|
||||
ot_clear_gvariant (&files_variant);
|
||||
ot_clear_gvariant (&dirs_variant);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -906,9 +893,9 @@ ostree_repo_file_query_info (GFile *file,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
OstreeRepoFile *self = OSTREE_REPO_FILE (file);
|
||||
gboolean ret = FALSE;
|
||||
GFileInfo *info = NULL;
|
||||
OstreeRepoFile *self = OSTREE_REPO_FILE (file);
|
||||
ot_lobj GFileInfo *info = NULL;
|
||||
|
||||
if (!ostree_repo_file_ensure_resolved (self, error))
|
||||
goto out;
|
||||
@ -931,6 +918,8 @@ ostree_repo_file_query_info (GFile *file,
|
||||
out:
|
||||
if (!ret)
|
||||
g_clear_object (&info);
|
||||
else
|
||||
g_object_ref (info);
|
||||
return info;
|
||||
}
|
||||
|
||||
@ -956,10 +945,10 @@ ostree_repo_file_read (GFile *file,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GFile *local_file = NULL;
|
||||
GFileInputStream *ret_stream = NULL;
|
||||
OstreeRepoFile *self = OSTREE_REPO_FILE (file);
|
||||
const char *checksum;
|
||||
ot_lobj GFile *local_file = NULL;
|
||||
ot_lobj GFileInputStream *ret_stream = NULL;
|
||||
|
||||
if (!ostree_repo_file_ensure_resolved (self, error))
|
||||
goto out;
|
||||
@ -990,9 +979,10 @@ ostree_repo_file_read (GFile *file,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_clear_object (&local_file);
|
||||
if (!ret)
|
||||
g_clear_object (&ret_stream);
|
||||
else
|
||||
g_object_ref (ret_stream);
|
||||
return ret_stream;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -59,9 +59,9 @@ ostree_run_triggers_in_root (GFile *root,
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
int estatus;
|
||||
char *rel_triggerdir = NULL;
|
||||
GFile *triggerdir = NULL;
|
||||
GPtrArray *argv = NULL;
|
||||
ot_lfree char *rel_triggerdir = NULL;
|
||||
ot_lobj GFile *triggerdir = NULL;
|
||||
ot_lptrarray GPtrArray *argv = NULL;
|
||||
|
||||
rel_triggerdir = g_build_filename ("usr", "libexec", "ostree", "triggers.d", NULL);
|
||||
|
||||
@ -114,8 +114,5 @@ ostree_run_triggers_in_root (GFile *root,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_free (rel_triggerdir);
|
||||
g_clear_object (&triggerdir);
|
||||
ot_clear_ptrarray (&argv);
|
||||
return ret;
|
||||
}
|
||||
|
@ -42,11 +42,11 @@ ostree_traverse_dirtree (OstreeRepo *repo,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariant *tree = NULL;
|
||||
GVariant *files_variant = NULL;
|
||||
GVariant *dirs_variant = NULL;
|
||||
int n, i;
|
||||
GVariant *key;
|
||||
ot_lvariant GVariant *key;
|
||||
ot_lvariant GVariant *tree = NULL;
|
||||
ot_lvariant GVariant *files_variant = NULL;
|
||||
ot_lvariant GVariant *dirs_variant = NULL;
|
||||
|
||||
if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_DIR_TREE, dirtree_checksum, &tree, error))
|
||||
goto out;
|
||||
@ -105,10 +105,6 @@ ostree_traverse_dirtree (OstreeRepo *repo,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
ot_clear_gvariant (&key);
|
||||
ot_clear_gvariant (&tree);
|
||||
ot_clear_gvariant (&files_variant);
|
||||
ot_clear_gvariant (&dirs_variant);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -121,10 +117,10 @@ ostree_traverse_commit (OstreeRepo *repo,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GVariant *commit = NULL;
|
||||
const char *contents_checksum;
|
||||
const char *meta_checksum;
|
||||
GVariant *key;
|
||||
ot_lvariant GVariant *key;
|
||||
ot_lvariant GVariant *commit = NULL;
|
||||
|
||||
/* PARSE OSTREE_SERIALIZED_COMMIT_VARIANT */
|
||||
if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT, commit_checksum, &commit, error))
|
||||
@ -132,10 +128,12 @@ ostree_traverse_commit (OstreeRepo *repo,
|
||||
|
||||
key = ostree_object_name_serialize (commit_checksum, OSTREE_OBJECT_TYPE_COMMIT);
|
||||
g_hash_table_replace (inout_reachable, key, key);
|
||||
key = NULL;
|
||||
|
||||
g_variant_get_child (commit, 7, "&s", &meta_checksum);
|
||||
key = ostree_object_name_serialize (meta_checksum, OSTREE_OBJECT_TYPE_DIR_META);
|
||||
g_hash_table_replace (inout_reachable, key, key);
|
||||
key = NULL;
|
||||
|
||||
g_variant_get_child (commit, 6, "&s", &contents_checksum);
|
||||
if (!ostree_traverse_dirtree (repo, contents_checksum, inout_reachable, cancellable, error))
|
||||
@ -158,7 +156,6 @@ ostree_traverse_commit (OstreeRepo *repo,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
ot_clear_gvariant (&commit);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user