mirror of
https://github.com/ostreedev/ostree.git
synced 2025-03-19 22:50:35 +03:00
core: Drop ot_clear_gvariant() in favor of g_clear_pointer
This commit is contained in:
parent
57fcafd1ab
commit
2ced4abf11
@ -729,7 +729,7 @@ ostree_set_xattrs (GFile *f,
|
||||
value_data = g_variant_get_fixed_array (value, &value_len, 1);
|
||||
|
||||
loop_err = lsetxattr (path, (char*)name, (char*)value_data, value_len, XATTR_REPLACE) < 0;
|
||||
ot_clear_gvariant (&value);
|
||||
g_clear_pointer (&value, (GDestroyNotify) g_variant_unref);
|
||||
if (loop_err)
|
||||
{
|
||||
ot_util_set_error_from_errno (error, errno);
|
||||
|
@ -59,8 +59,8 @@ ostree_repo_file_finalize (GObject *object)
|
||||
|
||||
self = OSTREE_REPO_FILE (object);
|
||||
|
||||
ot_clear_gvariant (&self->tree_contents);
|
||||
ot_clear_gvariant (&self->tree_metadata);
|
||||
g_clear_pointer (&self->tree_contents, (GDestroyNotify) g_variant_unref);
|
||||
g_clear_pointer (&self->tree_metadata, (GDestroyNotify) g_variant_unref);
|
||||
g_free (self->cached_file_checksum);
|
||||
g_free (self->tree_contents_checksum);
|
||||
g_free (self->tree_metadata_checksum);
|
||||
@ -217,7 +217,7 @@ do_resolve_nonroot (OstreeRepoFile *self,
|
||||
|
||||
files_variant = g_variant_get_child_value (self->parent->tree_contents, 0);
|
||||
self->index = g_variant_n_children (files_variant) + i;
|
||||
ot_clear_gvariant (&files_variant);
|
||||
g_clear_pointer (&files_variant, (GDestroyNotify) g_variant_unref);
|
||||
|
||||
g_variant_get_child (container, i, "(&s@ay@ay)",
|
||||
&name, &content_csum_v, &metadata_csum_v);
|
||||
@ -331,7 +331,7 @@ ostree_repo_file_tree_set_metadata (OstreeRepoFile *self,
|
||||
const char *checksum,
|
||||
GVariant *metadata)
|
||||
{
|
||||
ot_clear_gvariant (&self->tree_metadata);
|
||||
g_clear_pointer (&self->tree_metadata, (GDestroyNotify) g_variant_unref);
|
||||
self->tree_metadata = g_variant_ref (metadata);
|
||||
g_free (self->tree_metadata_checksum);
|
||||
self->tree_metadata_checksum = g_strdup (checksum);
|
||||
@ -396,8 +396,8 @@ ostree_repo_file_get_checksum (OstreeRepoFile *self)
|
||||
g_variant_get_child (files_variant, n,
|
||||
"(@s@ay)", NULL, &csum_bytes);
|
||||
}
|
||||
ot_clear_gvariant (&files_variant);
|
||||
ot_clear_gvariant (&dirs_variant);
|
||||
g_clear_pointer (&files_variant, (GDestroyNotify) g_variant_unref);
|
||||
g_clear_pointer (&dirs_variant, (GDestroyNotify) g_variant_unref);
|
||||
|
||||
self->cached_file_checksum = ostree_checksum_from_bytes_v (csum_bytes);
|
||||
|
||||
@ -792,9 +792,9 @@ ostree_repo_file_tree_find_child (OstreeRepoFile *self,
|
||||
*out_container = ret_container;
|
||||
ret_container = NULL;
|
||||
}
|
||||
ot_clear_gvariant (&ret_container);
|
||||
ot_clear_gvariant (&files_variant);
|
||||
ot_clear_gvariant (&dirs_variant);
|
||||
g_clear_pointer (&ret_container, (GDestroyNotify) g_variant_unref);
|
||||
g_clear_pointer (&files_variant, (GDestroyNotify) g_variant_unref);
|
||||
g_clear_pointer (&dirs_variant, (GDestroyNotify) g_variant_unref);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -2802,7 +2802,7 @@ stage_directory_to_mtree_internal (OstreeRepo *self,
|
||||
|
||||
if (!(modifier && modifier->skip_xattrs))
|
||||
{
|
||||
ot_clear_gvariant (&xattrs);
|
||||
g_clear_pointer (&xattrs, (GDestroyNotify) g_variant_unref);
|
||||
if (!ostree_get_xattrs_for_file (child, &xattrs, cancellable, error))
|
||||
goto out;
|
||||
}
|
||||
@ -3751,7 +3751,7 @@ find_object_in_packs (OstreeRepo *self,
|
||||
const char *pack_checksum = index_checksums->pdata[i];
|
||||
guint64 offset;
|
||||
|
||||
ot_clear_gvariant (&index_variant);
|
||||
g_clear_pointer (&index_variant, (GDestroyNotify) g_variant_unref);
|
||||
if (!ostree_repo_load_pack_index (self, pack_checksum, is_meta, &index_variant,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
@ -4549,7 +4549,7 @@ ostree_repo_checkout_tree_async (OstreeRepo *self,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
|
||||
ot_clear_gvariant (&xattrs);
|
||||
g_clear_pointer (&xattrs, (GDestroyNotify) g_variant_unref);
|
||||
|
||||
dir_enum = g_file_enumerate_children ((GFile*)checkout_data->source,
|
||||
OSTREE_GIO_FAST_QUERYINFO,
|
||||
|
@ -76,7 +76,7 @@ traverse_dirtree_internal (OstreeRepo *repo,
|
||||
{
|
||||
const char *filename;
|
||||
|
||||
ot_clear_gvariant (&csum_v);
|
||||
g_clear_pointer (&csum_v, (GDestroyNotify) g_variant_unref);
|
||||
g_variant_get_child (files_variant, i, "(&s@ay)", &filename, &csum_v);
|
||||
g_free (tmp_checksum);
|
||||
tmp_checksum = ostree_checksum_from_bytes_v (csum_v);
|
||||
@ -91,8 +91,8 @@ traverse_dirtree_internal (OstreeRepo *repo,
|
||||
{
|
||||
const char *dirname;
|
||||
|
||||
ot_clear_gvariant (&content_csum_v);
|
||||
ot_clear_gvariant (&metadata_csum_v);
|
||||
g_clear_pointer (&content_csum_v, (GDestroyNotify) g_variant_unref);
|
||||
g_clear_pointer (&metadata_csum_v, (GDestroyNotify) g_variant_unref);
|
||||
g_variant_get_child (dirs_variant, i, "(&s@ay@ay)",
|
||||
&dirname, &content_csum_v, &metadata_csum_v);
|
||||
|
||||
|
@ -27,12 +27,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define ot_clear_gvariant(a_v) do { \
|
||||
if (*a_v) \
|
||||
g_variant_unref (*a_v); \
|
||||
*a_v = NULL; \
|
||||
} while (0);
|
||||
|
||||
#define ot_clear_ptrarray(a_v) do { \
|
||||
if (*a_v) \
|
||||
g_ptr_array_unref (*a_v); \
|
||||
|
@ -208,13 +208,13 @@ fsck_reachable_objects_from_commits (OtFsckData *data,
|
||||
|
||||
g_clear_object (&input);
|
||||
g_clear_object (&file_info);
|
||||
ot_clear_gvariant (&xattrs);
|
||||
g_clear_pointer (&xattrs, (GDestroyNotify) g_variant_unref);
|
||||
|
||||
if (objtype == OSTREE_OBJECT_TYPE_COMMIT
|
||||
|| objtype == OSTREE_OBJECT_TYPE_DIR_TREE
|
||||
|| objtype == OSTREE_OBJECT_TYPE_DIR_META)
|
||||
{
|
||||
ot_clear_gvariant (&metadata);
|
||||
g_clear_pointer (&metadata, (GDestroyNotify) g_variant_unref);
|
||||
if (!ostree_repo_load_variant (data->repo, objtype,
|
||||
checksum, &metadata, error))
|
||||
{
|
||||
|
@ -83,15 +83,15 @@ ostree_builtin_log (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
GVariant *commit_metadata = NULL;
|
||||
char *formatted_metadata = NULL;
|
||||
|
||||
ot_clear_gvariant (&commit);
|
||||
g_clear_pointer (&commit, (GDestroyNotify) g_variant_unref);
|
||||
if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT, resolved_rev, &commit, error))
|
||||
goto out;
|
||||
|
||||
/* Ignore commit metadata for now */
|
||||
ot_clear_gvariant (&commit_metadata);
|
||||
ot_clear_gvariant (&parent_csum_v);
|
||||
ot_clear_gvariant (&content_csum_v);
|
||||
ot_clear_gvariant (&metadata_csum_v);
|
||||
g_clear_pointer (&commit_metadata, (GDestroyNotify) g_variant_unref);
|
||||
g_clear_pointer (&parent_csum_v, (GDestroyNotify) g_variant_unref);
|
||||
g_clear_pointer (&content_csum_v, (GDestroyNotify) g_variant_unref);
|
||||
g_clear_pointer (&metadata_csum_v, (GDestroyNotify) g_variant_unref);
|
||||
g_variant_get (commit, "(@a{sv}@ay@a(say)&s&st@ay@ay)",
|
||||
&commit_metadata, &parent_csum_v, NULL, &subject, &body,
|
||||
×tamp, &content_csum_v, &metadata_csum_v);
|
||||
@ -101,7 +101,7 @@ ostree_builtin_log (int argc, char **argv, GFile *repo_path, GError **error)
|
||||
g_date_time_unref (time_obj);
|
||||
time_obj = NULL;
|
||||
|
||||
ot_clear_gvariant (&commit_metadata);
|
||||
g_clear_pointer (&commit_metadata, (GDestroyNotify) g_variant_unref);
|
||||
formatted = g_strdup_printf ("commit %s\nSubject: %s\nDate: %s\nMetadata: %s\n\n",
|
||||
resolved_rev, subject, formatted_date, formatted_metadata);
|
||||
g_free (formatted_metadata);
|
||||
|
Loading…
x
Reference in New Issue
Block a user