diff options
42 files changed, 480 insertions, 521 deletions
diff --git a/Makefile-otutil.am b/Makefile-otutil.am index 8afab956..8598025c 100644 --- a/Makefile-otutil.am +++ b/Makefile-otutil.am @@ -24,7 +24,6 @@ endif libotutil_la_SOURCES = \ src/libotutil/ot-checksum-utils.c \ src/libotutil/ot-checksum-utils.h \ - src/libotutil/ot-local-alloc.h \ src/libotutil/ot-keyfile-utils.c \ src/libotutil/ot-keyfile-utils.h \ src/libotutil/ot-opt-utils.c \ diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c index fb2923fb..fe76bd46 100644 --- a/src/libostree/ostree-core.c +++ b/src/libostree/ostree-core.c @@ -223,9 +223,9 @@ ostree_get_xattrs_for_file (GFile *f, gboolean ret = FALSE; const char *path; ssize_t bytes_read; - ot_lvariant GVariant *ret_xattrs = NULL; - ot_lfree char *xattr_names = NULL; - ot_lfree char *xattr_names_canonical = NULL; + gs_unref_variant GVariant *ret_xattrs = NULL; + gs_free char *xattr_names = NULL; + gs_free char *xattr_names_canonical = NULL; GVariantBuilder builder; gboolean builder_initialized = FALSE; @@ -279,7 +279,7 @@ ostree_file_header_new (GFileInfo *file_info, guint32 rdev; const char *symlink_target; GVariant *ret; - ot_lvariant GVariant *tmp_xattrs = NULL; + gs_unref_variant GVariant *tmp_xattrs = NULL; uid = g_file_info_get_attribute_uint32 (file_info, "unix::uid"); gid = g_file_info_get_attribute_uint32 (file_info, "unix::gid"); @@ -312,7 +312,7 @@ ostree_zlib_file_header_new (GFileInfo *file_info, guint32 rdev; const char *symlink_target; GVariant *ret; - ot_lvariant GVariant *tmp_xattrs = NULL; + gs_unref_variant GVariant *tmp_xattrs = NULL; size = g_file_info_get_size (file_info); uid = g_file_info_get_attribute_uint32 (file_info, "unix::uid"); @@ -449,11 +449,11 @@ ostree_raw_file_to_content_stream (GInputStream *input, gboolean ret = FALSE; gpointer header_data; gsize header_size; - ot_lobj GInputStream *ret_input = NULL; - ot_lvariant GVariant *file_header = NULL; - ot_lptrarray GPtrArray *streams = NULL; - ot_lobj GOutputStream *header_out_stream = NULL; - ot_lobj GInputStream *header_in_stream = NULL; + gs_unref_object GInputStream *ret_input = NULL; + gs_unref_variant GVariant *file_header = NULL; + gs_unref_ptrarray GPtrArray *streams = NULL; + gs_unref_object GOutputStream *header_out_stream = NULL; + gs_unref_object GInputStream *header_in_stream = NULL; file_header = ostree_file_header_new (file_info, xattrs); @@ -501,12 +501,12 @@ ostree_content_stream_parse (gboolean compressed, guint32 archive_header_size; guchar dummy[4]; gsize bytes_read; - ot_lobj GInputStream *ret_input = NULL; - ot_lobj GFileInfo *content_file_info = NULL; - ot_lobj GFileInfo *ret_file_info = NULL; - ot_lvariant GVariant *ret_xattrs = NULL; - ot_lvariant GVariant *file_header = NULL; - ot_lfree guchar *buf = NULL; + gs_unref_object GInputStream *ret_input = NULL; + gs_unref_object GFileInfo *content_file_info = NULL; + gs_unref_object GFileInfo *ret_file_info = NULL; + gs_unref_variant GVariant *ret_xattrs = NULL; + gs_unref_variant GVariant *file_header = NULL; + gs_free guchar *buf = NULL; if (!g_input_stream_read_all (input, &archive_header_size, 4, &bytes_read, @@ -570,7 +570,7 @@ ostree_content_stream_parse (gboolean compressed, **/ if (compressed) { - ot_lobj GConverter *zlib_decomp = (GConverter*)g_zlib_decompressor_new (G_ZLIB_COMPRESSOR_FORMAT_RAW); + gs_unref_object GConverter *zlib_decomp = (GConverter*)g_zlib_decompressor_new (G_ZLIB_COMPRESSOR_FORMAT_RAW); ret_input = g_converter_input_stream_new (input, zlib_decomp); } else @@ -598,10 +598,10 @@ ostree_content_file_parse (gboolean compressed, gboolean ret = FALSE; guint64 length; struct stat stbuf; - ot_lobj GInputStream *file_input = NULL; - ot_lobj GInputStream *ret_input = NULL; - ot_lobj GFileInfo *ret_file_info = NULL; - ot_lvariant GVariant *ret_xattrs = NULL; + gs_unref_object GInputStream *file_input = NULL; + gs_unref_object GInputStream *ret_input = NULL; + gs_unref_object GFileInfo *ret_file_info = NULL; + gs_unref_variant GVariant *ret_xattrs = NULL; if (out_input) { @@ -657,7 +657,7 @@ ostree_checksum_file_from_input (GFileInfo *file_info, GError **error) { gboolean ret = FALSE; - ot_lfree guchar *ret_csum = NULL; + gs_free guchar *ret_csum = NULL; GChecksum *checksum = NULL; checksum = g_checksum_new (G_CHECKSUM_SHA256); @@ -669,14 +669,14 @@ ostree_checksum_file_from_input (GFileInfo *file_info, } else if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY) { - ot_lvariant GVariant *dirmeta = ostree_create_directory_metadata (file_info, xattrs); + gs_unref_variant GVariant *dirmeta = ostree_create_directory_metadata (file_info, xattrs); g_checksum_update (checksum, g_variant_get_data (dirmeta), g_variant_get_size (dirmeta)); } else { - ot_lvariant GVariant *file_header = NULL; + gs_unref_variant GVariant *file_header = NULL; file_header = ostree_file_header_new (file_info, xattrs); @@ -708,10 +708,10 @@ ostree_checksum_file (GFile *f, GError **error) { gboolean ret = FALSE; - ot_lobj GFileInfo *file_info = NULL; - ot_lobj GInputStream *in = NULL; - ot_lvariant GVariant *xattrs = NULL; - ot_lfree guchar *ret_csum = NULL; + gs_unref_object GFileInfo *file_info = NULL; + gs_unref_object GInputStream *in = NULL; + gs_unref_variant GVariant *xattrs = NULL; + gs_free guchar *ret_csum = NULL; if (g_cancellable_set_error_if_cancelled (cancellable, error)) return FALSE; @@ -1093,8 +1093,8 @@ ostree_file_header_parse (GVariant *metadata, gboolean ret = FALSE; guint32 uid, gid, mode, rdev; const char *symlink_target; - ot_lobj GFileInfo *ret_file_info = NULL; - ot_lvariant GVariant *ret_xattrs = NULL; + gs_unref_object GFileInfo *ret_file_info = NULL; + gs_unref_variant GVariant *ret_xattrs = NULL; g_variant_get (metadata, "(uuuu&s@a(ayay))", &uid, &gid, &mode, &rdev, @@ -1152,8 +1152,8 @@ ostree_zlib_file_header_parse (GVariant *metadata, guint64 size; guint32 uid, gid, mode, rdev; const char *symlink_target; - ot_lobj GFileInfo *ret_file_info = NULL; - ot_lvariant GVariant *ret_xattrs = NULL; + gs_unref_object GFileInfo *ret_file_info = NULL; + gs_unref_variant GVariant *ret_xattrs = NULL; g_variant_get (metadata, "(tuuuu&s@a(ayay))", &size, &uid, &gid, &mode, &rdev, @@ -1214,7 +1214,7 @@ ostree_create_file_from_input (GFile *dest_file, gboolean ret = FALSE; const char *dest_path; guint32 uid, gid, mode; - ot_lobj GFileOutputStream *out = NULL; + gs_unref_object GFileOutputStream *out = NULL; if (g_cancellable_set_error_if_cancelled (cancellable, error)) return FALSE; @@ -1389,13 +1389,13 @@ ostree_create_temp_file_from_input (GFile *dir, gboolean ret = FALSE; GError *temp_error = NULL; int i = 0; - ot_lobj GFile *possible_file = NULL; - ot_lfree guchar *ret_csum = NULL; + gs_unref_object GFile *possible_file = NULL; + gs_free guchar *ret_csum = NULL; /* 128 attempts seems reasonable... */ for (i = 0; i < 128; i++) { - ot_lfree char *possible_name = NULL; + gs_free char *possible_name = NULL; if (g_cancellable_set_error_if_cancelled (cancellable, error)) goto out; @@ -1447,8 +1447,8 @@ ostree_create_temp_regular_file (GFile *dir, GError **error) { gboolean ret = FALSE; - ot_lobj GFile *ret_file = NULL; - ot_lobj GOutputStream *ret_stream = NULL; + gs_unref_object GFile *ret_file = NULL; + gs_unref_object GOutputStream *ret_stream = NULL; if (!ostree_create_temp_file_from_input (dir, prefix, suffix, NULL, NULL, NULL, &ret_file, cancellable, error)) @@ -1477,8 +1477,8 @@ ostree_create_temp_dir (GFile *dir, GError **error) { gboolean ret = FALSE; - ot_lfree char *template = NULL; - ot_lobj GFile *ret_file = NULL; + gs_free char *template = NULL; + gs_unref_object GFile *ret_file = NULL; if (dir == NULL) dir = g_file_new_for_path (g_get_tmp_dir ()); @@ -1587,9 +1587,9 @@ ostree_validate_structureof_commit (GVariant *commit, GError **error) { gboolean ret = FALSE; - ot_lvariant GVariant *parent_csum_v = NULL; - ot_lvariant GVariant *content_csum_v = NULL; - ot_lvariant GVariant *metadata_csum_v = NULL; + gs_unref_variant GVariant *parent_csum_v = NULL; + gs_unref_variant GVariant *content_csum_v = NULL; + gs_unref_variant GVariant *metadata_csum_v = NULL; gsize n_elts; if (!validate_variant (commit, OSTREE_COMMIT_GVARIANT_FORMAT, error)) @@ -1622,8 +1622,8 @@ ostree_validate_structureof_dirtree (GVariant *dirtree, { gboolean ret = FALSE; const char *filename; - ot_lvariant GVariant *content_csum_v = NULL; - ot_lvariant GVariant *meta_csum_v = NULL; + gs_unref_variant GVariant *content_csum_v = NULL; + gs_unref_variant GVariant *meta_csum_v = NULL; GVariantIter *contents_iter = NULL; if (!validate_variant (dirtree, OSTREE_TREE_GVARIANT_FORMAT, error)) diff --git a/src/libostree/ostree-diff.c b/src/libostree/ostree-diff.c index ccae4ed2..0a8222da 100644 --- a/src/libostree/ostree-diff.c +++ b/src/libostree/ostree-diff.c @@ -35,8 +35,8 @@ get_file_checksum (GFile *f, GError **error) { gboolean ret = FALSE; - ot_lfree char *ret_checksum = NULL; - ot_lfree guchar *csum = NULL; + gs_free char *ret_checksum = NULL; + gs_free guchar *csum = NULL; if (OSTREE_IS_REPO_FILE (f)) { @@ -107,8 +107,8 @@ diff_files (GFile *a, GError **error) { gboolean ret = FALSE; - ot_lfree char *checksum_a = NULL; - ot_lfree char *checksum_b = NULL; + gs_free char *checksum_a = NULL; + gs_free char *checksum_b = NULL; OstreeDiffItem *ret_item = NULL; if (!get_file_checksum (a, a_info, &checksum_a, cancellable, error)) @@ -138,9 +138,9 @@ diff_add_dir_recurse (GFile *d, { gboolean ret = FALSE; GError *temp_error = NULL; - ot_lobj GFileEnumerator *dir_enum = NULL; - ot_lobj GFile *child = NULL; - ot_lobj GFileInfo *child_info = NULL; + gs_unref_object GFileEnumerator *dir_enum = NULL; + gs_unref_object GFile *child = NULL; + gs_unref_object GFileInfo *child_info = NULL; dir_enum = g_file_enumerate_children (d, OSTREE_GIO_FAST_QUERYINFO, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, @@ -196,11 +196,11 @@ ostree_diff_dirs (GFile *a, { gboolean ret = FALSE; GError *temp_error = NULL; - ot_lobj GFileEnumerator *dir_enum = NULL; - ot_lobj GFile *child_a = NULL; - ot_lobj GFile *child_b = NULL; - ot_lobj GFileInfo *child_a_info = NULL; - ot_lobj GFileInfo *child_b_info = NULL; + gs_unref_object GFileEnumerator *dir_enum = NULL; + gs_unref_object GFile *child_a = NULL; + gs_unref_object GFile *child_b = NULL; + gs_unref_object GFileInfo *child_a_info = NULL; + gs_unref_object GFileInfo *child_b_info = NULL; child_a_info = g_file_query_info (a, OSTREE_GIO_FAST_QUERYINFO, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, diff --git a/src/libostree/ostree-mutable-tree.c b/src/libostree/ostree-mutable-tree.c index 890e1e77..95f17a5a 100644 --- a/src/libostree/ostree-mutable-tree.c +++ b/src/libostree/ostree-mutable-tree.c @@ -166,7 +166,7 @@ ostree_mutable_tree_ensure_dir (OstreeMutableTree *self, GError **error) { gboolean ret = FALSE; - ot_lobj OstreeMutableTree *ret_dir = NULL; + gs_unref_object OstreeMutableTree *ret_dir = NULL; g_return_val_if_fail (name != NULL, FALSE); @@ -199,8 +199,8 @@ ostree_mutable_tree_lookup (OstreeMutableTree *self, GError **error) { gboolean ret = FALSE; - ot_lobj OstreeMutableTree *ret_subdir = NULL; - ot_lfree char *ret_file_checksum = NULL; + gs_unref_object OstreeMutableTree *ret_subdir = NULL; + gs_free char *ret_file_checksum = NULL; ret_subdir = ot_gobject_refz (g_hash_table_lookup (self->subdirs, name)); if (!ret_subdir) @@ -230,7 +230,7 @@ ostree_mutable_tree_ensure_parent_dirs (OstreeMutableTree *self, gboolean ret = FALSE; int i; OstreeMutableTree *subdir = self; /* nofree */ - ot_lobj OstreeMutableTree *ret_parent = NULL; + gs_unref_object OstreeMutableTree *ret_parent = NULL; g_assert (metadata_checksum != NULL); diff --git a/src/libostree/ostree-repo-file.c b/src/libostree/ostree-repo-file.c index 0fb3a630..ad2b7f36 100644 --- a/src/libostree/ostree-repo-file.c +++ b/src/libostree/ostree-repo-file.c @@ -150,11 +150,11 @@ do_resolve_commit (OstreeRepoFile *self, GError **error) { gboolean ret = FALSE; - ot_lvariant GVariant *commit = NULL; - ot_lvariant GVariant *root_contents = NULL; - ot_lvariant GVariant *root_metadata = NULL; - ot_lvariant GVariant *tree_contents_csum_v = NULL; - ot_lvariant GVariant *tree_metadata_csum_v = NULL; + gs_unref_variant GVariant *commit = NULL; + gs_unref_variant GVariant *root_contents = NULL; + gs_unref_variant GVariant *root_metadata = NULL; + gs_unref_variant GVariant *tree_contents_csum_v = NULL; + gs_unref_variant GVariant *tree_metadata_csum_v = NULL; g_assert (self->parent == NULL); @@ -195,12 +195,12 @@ do_resolve_nonroot (OstreeRepoFile *self, gboolean ret = FALSE; gboolean is_dir; int i; - ot_lvariant GVariant *container = NULL; - ot_lvariant GVariant *tree_contents = NULL; - ot_lvariant GVariant *tree_metadata = NULL; - ot_lvariant GVariant *content_csum_v = NULL; - ot_lvariant GVariant *metadata_csum_v = NULL; - ot_lfree char *tmp_checksum = NULL; + gs_unref_variant GVariant *container = NULL; + gs_unref_variant GVariant *tree_contents = NULL; + gs_unref_variant GVariant *tree_metadata = NULL; + gs_unref_variant GVariant *content_csum_v = NULL; + gs_unref_variant GVariant *metadata_csum_v = NULL; + gs_free char *tmp_checksum = NULL; i = ostree_repo_file_tree_find_child (self->parent, self->name, &is_dir, &container); @@ -294,7 +294,7 @@ ostree_repo_file_get_xattrs (OstreeRepoFile *self, GError **error) { gboolean ret = FALSE; - ot_lvariant GVariant *ret_xattrs = NULL; + gs_unref_variant GVariant *ret_xattrs = NULL; if (!ostree_repo_file_ensure_resolved (self, error)) goto out; @@ -687,8 +687,8 @@ query_child_info_dir (OstreeRepo *repo, GError **error) { gboolean ret = FALSE; - ot_lobj GFileInfo *ret_info = NULL; - ot_lvariant GVariant *metadata = NULL; + gs_unref_object GFileInfo *ret_info = NULL; + gs_unref_variant GVariant *metadata = NULL; ret_info = g_file_info_new (); @@ -724,7 +724,7 @@ bsearch_in_file_variant (GVariant *variant, imin = 0; while (imax >= imin) { - ot_lvariant GVariant *child = NULL; + gs_unref_variant GVariant *child = NULL; const char *cur; int cmp; @@ -810,12 +810,12 @@ ostree_repo_file_tree_query_child (OstreeRepoFile *self, gboolean ret = FALSE; 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; - ot_lvariant GVariant *content_csum_v = NULL; - ot_lvariant GVariant *meta_csum_v = NULL; + gs_unref_object GFileInfo *ret_info = NULL; + gs_unref_variant GVariant *files_variant = NULL; + gs_unref_variant GVariant *dirs_variant = NULL; + gs_unref_variant GVariant *tree_child_metadata = NULL; + gs_unref_variant GVariant *content_csum_v = NULL; + gs_unref_variant GVariant *meta_csum_v = NULL; char tmp_checksum[65]; GFileAttributeMatcher *matcher = NULL; @@ -891,7 +891,7 @@ ostree_repo_file_query_info (GFile *file, { gboolean ret = FALSE; OstreeRepoFile *self = OSTREE_REPO_FILE (file); - ot_lobj GFileInfo *info = NULL; + gs_unref_object GFileInfo *info = NULL; if (!ostree_repo_file_ensure_resolved (self, error)) goto out; @@ -943,8 +943,8 @@ ostree_repo_file_read (GFile *file, gboolean ret = FALSE; OstreeRepoFile *self = OSTREE_REPO_FILE (file); const char *checksum; - ot_lobj GFile *local_file = NULL; - ot_lobj GInputStream *ret_stream = NULL; + gs_unref_object GFile *local_file = NULL; + gs_unref_object GInputStream *ret_stream = NULL; if (!ostree_repo_file_ensure_resolved (self, error)) goto out; diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index d53e4c64..0975e72a 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -231,7 +231,7 @@ parse_rev_file (OstreeRepo *self, { gboolean ret = FALSE; GError *temp_error = NULL; - ot_lfree char *rev = NULL; + gs_free char *rev = NULL; if ((rev = gs_file_load_contents_utf8 (f, NULL, &temp_error)) == NULL) goto out; @@ -255,7 +255,7 @@ parse_rev_file (OstreeRepo *self, if (g_str_has_prefix (rev, "ref: ")) { - ot_lobj GFile *ref = NULL; + gs_unref_object GFile *ref = NULL; char *ref_sha256; gboolean subret; @@ -290,8 +290,8 @@ find_ref_in_remotes (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - ot_lobj GFileEnumerator *dir_enum = NULL; - ot_lobj GFile *ret_file = NULL; + gs_unref_object GFileEnumerator *dir_enum = NULL; + gs_unref_object GFile *ret_file = NULL; dir_enum = g_file_enumerate_children (self->remote_heads_dir, OSTREE_GIO_FAST_QUERYINFO, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, @@ -378,11 +378,11 @@ resolve_refspec (OstreeRepo *self, gboolean ret = FALSE; __attribute__((unused)) GCancellable *cancellable = NULL; GError *temp_error = NULL; - ot_lfree char *tmp = NULL; - ot_lfree char *tmp2 = NULL; - ot_lfree char *ret_rev = NULL; - ot_lobj GFile *child = NULL; - ot_lobj GFile *origindir = NULL; + gs_free char *tmp = NULL; + gs_free char *tmp2 = NULL; + gs_free char *ret_rev = NULL; + gs_unref_object GFile *child = NULL; + gs_unref_object GFile *origindir = NULL; g_return_val_if_fail (ref != NULL, FALSE); @@ -518,10 +518,10 @@ write_checksum_file (GFile *parentdir, gboolean ret = FALSE; gsize bytes_written; int i; - ot_lobj GFile *parent = NULL; - ot_lobj GFile *child = NULL; - ot_lobj GOutputStream *out = NULL; - ot_lptrarray GPtrArray *components = NULL; + gs_unref_object GFile *parent = NULL; + gs_unref_object GFile *child = NULL; + gs_unref_object GOutputStream *out = NULL; + gs_unref_ptrarray GPtrArray *components = NULL; if (!ostree_validate_checksum_string (sha256, error)) goto out; @@ -624,7 +624,7 @@ ostree_repo_write_config (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - ot_lfree char *data = NULL; + gs_free char *data = NULL; gsize len; g_return_val_if_fail (self->inited, FALSE); @@ -676,9 +676,9 @@ ostree_repo_check (OstreeRepo *self, GError **error) { gboolean ret = FALSE; gboolean is_archive; - ot_lfree char *version = NULL; - ot_lfree char *mode = NULL; - ot_lfree char *parent_repo_path = NULL; + gs_free char *version = NULL; + gs_free char *mode = NULL; + gs_free char *parent_repo_path = NULL; g_return_val_if_fail (error == NULL || *error == NULL, FALSE); @@ -736,7 +736,7 @@ ostree_repo_check (OstreeRepo *self, GError **error) if (parent_repo_path && parent_repo_path[0]) { - ot_lobj GFile *parent_repo_f = g_file_new_for_path (parent_repo_path); + gs_unref_object GFile *parent_repo_f = g_file_new_for_path (parent_repo_path); self->parent_repo = ostree_repo_new (parent_repo_f); @@ -805,7 +805,7 @@ GFile * ostree_repo_get_archive_content_path (OstreeRepo *self, const char *checksum) { - ot_lfree char *path = NULL; + gs_free char *path = NULL; g_assert (ostree_repo_get_mode (self) == OSTREE_REPO_MODE_ARCHIVE); @@ -822,7 +822,7 @@ commit_loose_object_impl (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - ot_lobj GFile *parent = NULL; + gs_unref_object GFile *parent = NULL; parent = g_file_get_parent (dest); if (!gs_file_ensure_directory (parent, FALSE, cancellable, error)) @@ -863,7 +863,7 @@ commit_loose_object_trusted (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - ot_lobj GFile *dest_file = NULL; + gs_unref_object GFile *dest_file = NULL; dest_file = ostree_repo_get_object_path (self, checksum, objtype); @@ -890,12 +890,12 @@ stage_object (OstreeRepo *self, const char *actual_checksum; gboolean do_commit; OstreeRepoMode repo_mode; - ot_lobj GFileInfo *temp_info = NULL; - ot_lobj GFile *temp_file = NULL; - ot_lobj GFile *raw_temp_file = NULL; - ot_lobj GFile *stored_path = NULL; - ot_lfree guchar *ret_csum = NULL; - ot_lobj OstreeChecksumInputStream *checksum_input = NULL; + gs_unref_object GFileInfo *temp_info = NULL; + gs_unref_object GFile *temp_file = NULL; + gs_unref_object GFile *raw_temp_file = NULL; + gs_unref_object GFile *stored_path = NULL; + gs_free guchar *ret_csum = NULL; + gs_unref_object OstreeChecksumInputStream *checksum_input = NULL; gboolean have_obj; GChecksum *checksum = NULL; gboolean staged_raw_file = FALSE; @@ -927,9 +927,9 @@ stage_object (OstreeRepo *self, if (objtype == OSTREE_OBJECT_TYPE_FILE) { - ot_lobj GInputStream *file_input = NULL; - ot_lobj GFileInfo *file_info = NULL; - ot_lvariant GVariant *xattrs = NULL; + gs_unref_object GInputStream *file_input = NULL; + gs_unref_object GFileInfo *file_info = NULL; + gs_unref_variant GVariant *xattrs = NULL; if (!ostree_content_stream_parse (FALSE, checksum_input ? (GInputStream*)checksum_input : input, file_object_length, FALSE, @@ -951,10 +951,10 @@ stage_object (OstreeRepo *self, } else if (repo_mode == OSTREE_REPO_MODE_ARCHIVE_Z2) { - ot_lvariant GVariant *file_meta = NULL; - ot_lobj GOutputStream *temp_out = NULL; - ot_lobj GConverter *zlib_compressor = NULL; - ot_lobj GOutputStream *compressed_out_stream = NULL; + gs_unref_variant GVariant *file_meta = NULL; + gs_unref_object GOutputStream *temp_out = NULL; + gs_unref_object GConverter *zlib_compressor = NULL; + gs_unref_object GOutputStream *compressed_out_stream = NULL; if (!ostree_create_temp_regular_file (self->tmp_dir, ostree_object_type_to_string (objtype), NULL, @@ -985,9 +985,9 @@ stage_object (OstreeRepo *self, } else if (repo_mode == OSTREE_REPO_MODE_ARCHIVE) { - ot_lvariant GVariant *file_meta = NULL; - ot_lobj GInputStream *file_meta_input = NULL; - ot_lobj GFileInfo *archive_content_file_info = NULL; + gs_unref_variant GVariant *file_meta = NULL; + gs_unref_object GInputStream *file_meta_input = NULL; + gs_unref_object GFileInfo *archive_content_file_info = NULL; file_meta = ostree_file_header_new (file_info, xattrs); file_meta_input = ot_variant_read (file_meta); @@ -1001,7 +1001,7 @@ stage_object (OstreeRepo *self, if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR) { - ot_lobj GOutputStream *content_out = NULL; + gs_unref_object GOutputStream *content_out = NULL; guint32 src_mode; guint32 target_mode; @@ -1078,9 +1078,9 @@ stage_object (OstreeRepo *self, if (!staged_raw_file && objtype == OSTREE_OBJECT_TYPE_FILE && self->mode == OSTREE_REPO_MODE_BARE) { - ot_lobj GInputStream *file_input = NULL; - ot_lobj GFileInfo *file_info = NULL; - ot_lvariant GVariant *xattrs = NULL; + gs_unref_object GInputStream *file_input = NULL; + gs_unref_object GFileInfo *file_info = NULL; + gs_unref_variant GVariant *xattrs = NULL; gboolean is_regular; if (!ostree_content_file_parse (FALSE, temp_file, FALSE, &file_input, @@ -1107,7 +1107,7 @@ stage_object (OstreeRepo *self, /* Commit content first so the process is atomic */ if (staged_archive_file) { - ot_lobj GFile *archive_content_dest = NULL; + gs_unref_object GFile *archive_content_dest = NULL; archive_content_dest = ostree_repo_get_archive_content_path (self, actual_checksum); @@ -1252,8 +1252,8 @@ scan_loose_devino (OstreeRepo *self, gboolean ret = FALSE; guint i; OstreeRepoMode repo_mode; - ot_lptrarray GPtrArray *object_dirs = NULL; - ot_lobj GFile *objdir = NULL; + gs_unref_ptrarray GPtrArray *object_dirs = NULL; + gs_unref_object GFile *objdir = NULL; if (self->parent_repo) { @@ -1269,8 +1269,8 @@ scan_loose_devino (OstreeRepo *self, for (i = 0; i < object_dirs->len; i++) { GFile *objdir = object_dirs->pdata[i]; - ot_lobj GFileEnumerator *enumerator = NULL; - ot_lobj GFileInfo *file_info = NULL; + gs_unref_object GFileEnumerator *enumerator = NULL; + gs_unref_object GFileInfo *file_info = NULL; const char *dirname; enumerator = g_file_enumerate_children (objdir, OSTREE_GIO_FAST_QUERYINFO, @@ -1431,8 +1431,8 @@ ostree_repo_stage_metadata (OstreeRepo *self, GCancellable *cancellable, GError **error) { - ot_lobj GInputStream *input = NULL; - ot_lvariant GVariant *normalized = NULL; + gs_unref_object GInputStream *input = NULL; + gs_unref_variant GVariant *normalized = NULL; normalized = g_variant_get_normal_form (variant); input = ot_variant_read (normalized); @@ -1455,8 +1455,8 @@ ostree_repo_stage_metadata_trusted (OstreeRepo *self, GCancellable *cancellable, GError **error) { - ot_lobj GInputStream *input = NULL; - ot_lvariant GVariant *normalized = NULL; + gs_unref_object GInputStream *input = NULL; + gs_unref_variant GVariant *normalized = NULL; normalized = g_variant_get_normal_form (variant); input = ot_variant_read (normalized); @@ -1568,7 +1568,7 @@ stage_directory_meta (OstreeRepo *self, GCancellable *cancellable, GError **error) { - ot_lvariant GVariant *dirmeta = NULL; + gs_unref_variant GVariant *dirmeta = NULL; if (g_cancellable_set_error_if_cancelled (cancellable, error)) return FALSE; @@ -1803,7 +1803,7 @@ enumerate_refs_recurse (OstreeRepo *repo, GError **error) { gboolean ret = FALSE; - ot_lobj GFileEnumerator *enumerator = NULL; + gs_unref_object GFileEnumerator *enumerator = NULL; enumerator = g_file_enumerate_children (dir, OSTREE_GIO_FAST_QUERYINFO, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, @@ -1938,10 +1938,10 @@ write_ref_summary (OstreeRepo *self, GHashTableIter hash_iter; gpointer key, value; gsize bytes_written; - ot_lhash GHashTable *all_refs = NULL; - ot_lobj GFile *summary_path = NULL; - ot_lobj GOutputStream *out = NULL; - ot_lfree char *buf = NULL; + gs_unref_hashtable GHashTable *all_refs = NULL; + gs_unref_object GFile *summary_path = NULL; + gs_unref_object GOutputStream *out = NULL; + gs_free char *buf = NULL; if (!ostree_repo_list_refs (self, NULL, &all_refs, cancellable, error)) goto out; @@ -1981,7 +1981,7 @@ ostree_repo_write_ref (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - ot_lobj GFile *dir = NULL; + gs_unref_object GFile *dir = NULL; if (remote == NULL) dir = g_object_ref (self->local_heads_dir); @@ -2063,9 +2063,9 @@ ostree_repo_stage_commit (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - ot_lfree char *ret_commit = NULL; - ot_lvariant GVariant *commit = NULL; - ot_lfree guchar *commit_csum = NULL; + gs_free char *ret_commit = NULL; + gs_unref_variant GVariant *commit = NULL; + gs_free guchar *commit_csum = NULL; GDateTime *now = NULL; g_return_val_if_fail (branch != NULL, FALSE); @@ -2224,9 +2224,9 @@ stage_directory_to_mtree_internal (OstreeRepo *self, gboolean ret = FALSE; gboolean repo_dir_was_empty = FALSE; OstreeRepoCommitFilterResult filter_result; - ot_lobj OstreeRepoFile *repo_dir = NULL; - ot_lobj GFileEnumerator *dir_enum = NULL; - ot_lobj GFileInfo *child_info = NULL; + gs_unref_object OstreeRepoFile *repo_dir = NULL; + gs_unref_object GFileEnumerator *dir_enum = NULL; + gs_unref_object GFileInfo *child_info = NULL; /* We can only reuse checksums directly if there's no modifier */ if (OSTREE_IS_REPO_FILE (dir) && modifier == NULL) @@ -2246,10 +2246,10 @@ stage_directory_to_mtree_internal (OstreeRepo *self, } else { - ot_lobj GFileInfo *modified_info = NULL; - ot_lvariant GVariant *xattrs = NULL; - ot_lfree guchar *child_file_csum = NULL; - ot_lfree char *tmp_checksum = NULL; + gs_unref_object GFileInfo *modified_info = NULL; + gs_unref_variant GVariant *xattrs = NULL; + gs_free guchar *child_file_csum = NULL; + gs_free char *tmp_checksum = NULL; child_info = g_file_query_info (dir, OSTREE_GIO_FAST_QUERYINFO, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, @@ -2330,11 +2330,11 @@ stage_directory_to_mtree_internal (OstreeRepo *self, { guint64 file_obj_length; const char *loose_checksum; - ot_lobj GInputStream *file_input = NULL; - ot_lvariant GVariant *xattrs = NULL; - ot_lobj GInputStream *file_object_input = NULL; - ot_lfree guchar *child_file_csum = NULL; - ot_lfree char *tmp_checksum = NULL; + gs_unref_object GInputStream *file_input = NULL; + gs_unref_variant GVariant *xattrs = NULL; + gs_unref_object GInputStream *file_object_input = NULL; + gs_free guchar *child_file_csum = NULL; + gs_free char *tmp_checksum = NULL; loose_checksum = devino_cache_lookup (self, child_info); @@ -2423,11 +2423,11 @@ ostree_repo_stage_mtree (OstreeRepo *self, GHashTableIter hash_iter; gpointer key, value; const char *existing_checksum; - ot_lfree char *ret_contents_checksum = NULL; - ot_lhash GHashTable *dir_metadata_checksums = NULL; - ot_lhash GHashTable *dir_contents_checksums = NULL; - ot_lvariant GVariant *serialized_tree = NULL; - ot_lfree guchar *contents_csum = NULL; + gs_free char *ret_contents_checksum = NULL; + gs_unref_hashtable GHashTable *dir_metadata_checksums = NULL; + gs_unref_hashtable GHashTable *dir_contents_checksums = NULL; + gs_unref_variant GVariant *serialized_tree = NULL; + gs_free guchar *contents_csum = NULL; existing_checksum = ostree_mutable_tree_get_contents_checksum (mtree); if (existing_checksum) @@ -2551,8 +2551,8 @@ import_libarchive_entry_file (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - ot_lobj GInputStream *file_object_input = NULL; - ot_lobj GInputStream *archive_stream = NULL; + gs_unref_object GInputStream *file_object_input = NULL; + gs_unref_object GInputStream *archive_stream = NULL; guint64 length; if (g_cancellable_set_error_if_cancelled (cancellable, error)) @@ -2588,16 +2588,16 @@ stage_libarchive_entry_to_mtree (OstreeRepo *self, const char *pathname; const char *hardlink; const char *basename; - ot_lobj GFileInfo *file_info = NULL; - ot_lptrarray GPtrArray *split_path = NULL; - ot_lptrarray GPtrArray *hardlink_split_path = NULL; - ot_lobj OstreeMutableTree *subdir = NULL; - ot_lobj OstreeMutableTree *parent = NULL; - ot_lobj OstreeMutableTree *hardlink_source_parent = NULL; - ot_lfree char *hardlink_source_checksum = NULL; - ot_lobj OstreeMutableTree *hardlink_source_subdir = NULL; - ot_lfree guchar *tmp_csum = NULL; - ot_lfree char *tmp_checksum = NULL; + gs_unref_object GFileInfo *file_info = NULL; + gs_unref_ptrarray GPtrArray *split_path = NULL; + gs_unref_ptrarray GPtrArray *hardlink_split_path = NULL; + gs_unref_object OstreeMutableTree *subdir = NULL; + gs_unref_object OstreeMutableTree *parent = NULL; + gs_unref_object OstreeMutableTree *hardlink_source_parent = NULL; + gs_free char *hardlink_source_checksum = NULL; + gs_unref_object OstreeMutableTree *hardlink_source_subdir = NULL; + gs_free guchar *tmp_csum = NULL; + gs_free char *tmp_checksum = NULL; pathname = archive_entry_pathname (entry); @@ -2746,8 +2746,8 @@ ostree_repo_stage_archive_to_mtree (OstreeRepo *self, struct archive *a = NULL; struct archive_entry *entry; int r; - ot_lobj GFileInfo *tmp_dir_info = NULL; - ot_lfree guchar *tmp_csum = NULL; + gs_unref_object GFileInfo *tmp_dir_info = NULL; + gs_free guchar *tmp_csum = NULL; a = archive_read_new (); archive_read_support_compression_all (a); @@ -2917,8 +2917,8 @@ list_loose_objects (OstreeRepo *self, { gboolean ret = FALSE; guint i; - ot_lptrarray GPtrArray *object_dirs = NULL; - ot_lobj GFile *objdir = NULL; + gs_unref_ptrarray GPtrArray *object_dirs = NULL; + gs_unref_object GFile *objdir = NULL; if (!get_loose_object_dirs (self, &object_dirs, cancellable, error)) goto out; @@ -2946,12 +2946,12 @@ ostree_repo_load_file (OstreeRepo *self, { gboolean ret = FALSE; OstreeRepoMode repo_mode; - ot_lvariant GVariant *file_data = NULL; - ot_lobj GFile *loose_path = NULL; - ot_lobj GFileInfo *content_loose_info = NULL; - ot_lobj GInputStream *ret_input = NULL; - ot_lobj GFileInfo *ret_file_info = NULL; - ot_lvariant GVariant *ret_xattrs = NULL; + gs_unref_variant GVariant *file_data = NULL; + gs_unref_object GFile *loose_path = NULL; + gs_unref_object GFileInfo *content_loose_info = NULL; + gs_unref_object GInputStream *ret_input = NULL; + gs_unref_object GFileInfo *ret_file_info = NULL; + gs_unref_variant GVariant *ret_xattrs = NULL; if (!repo_find_object (self, OSTREE_OBJECT_TYPE_FILE, checksum, &loose_path, cancellable, error)) @@ -2965,7 +2965,7 @@ ostree_repo_load_file (OstreeRepo *self, { case OSTREE_REPO_MODE_ARCHIVE: { - ot_lvariant GVariant *archive_meta = NULL; + gs_unref_variant GVariant *archive_meta = NULL; if (!ot_util_variant_map (loose_path, OSTREE_FILE_HEADER_GVARIANT_FORMAT, TRUE, &archive_meta, error)) @@ -2977,8 +2977,8 @@ ostree_repo_load_file (OstreeRepo *self, if (g_file_info_get_file_type (ret_file_info) == G_FILE_TYPE_REGULAR) { - ot_lobj GFile *archive_content_path = NULL; - ot_lobj GFileInfo *content_info = NULL; + gs_unref_object GFile *archive_content_path = NULL; + gs_unref_object GFileInfo *content_info = NULL; archive_content_path = ostree_repo_get_archive_content_path (self, checksum); content_info = g_file_query_info (archive_content_path, OSTREE_GIO_FAST_QUERYINFO, @@ -3068,8 +3068,8 @@ repo_find_object (OstreeRepo *self, { gboolean ret = FALSE; struct stat stbuf; - ot_lobj GFile *object_path = NULL; - ot_lobj GFile *ret_stored_path = NULL; + gs_unref_object GFile *object_path = NULL; + gs_unref_object GFile *ret_stored_path = NULL; object_path = ostree_repo_get_object_path (self, checksum, objtype); @@ -3100,7 +3100,7 @@ ostree_repo_has_object (OstreeRepo *self, { gboolean ret = FALSE; gboolean ret_have_object; - ot_lobj GFile *loose_path = NULL; + gs_unref_object GFile *loose_path = NULL; if (!repo_find_object (self, objtype, checksum, &loose_path, cancellable, error)) @@ -3130,7 +3130,7 @@ ostree_repo_load_variant_c (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - ot_lfree char *checksum = NULL; + gs_free char *checksum = NULL; checksum = ostree_checksum_from_bytes (csum); @@ -3152,8 +3152,8 @@ load_variant_internal (OstreeRepo *self, { gboolean ret = FALSE; GCancellable *cancellable = NULL; - ot_lobj GFile *object_path = NULL; - ot_lvariant GVariant *ret_variant = NULL; + gs_unref_object GFile *object_path = NULL; + gs_unref_variant GVariant *ret_variant = NULL; g_return_val_if_fail (OSTREE_OBJECT_TYPE_IS_META (objtype), FALSE); @@ -3245,7 +3245,7 @@ ostree_repo_list_objects (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - ot_lhash GHashTable *ret_objects = NULL; + gs_unref_hashtable GHashTable *ret_objects = NULL; g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (self->inited, FALSE); @@ -3291,9 +3291,9 @@ checkout_file_from_input (GFile *file, { gboolean ret = FALSE; GError *temp_error = NULL; - ot_lobj GFile *dir = NULL; - ot_lobj GFile *temp_file = NULL; - ot_lobj GFileInfo *temp_info = NULL; + gs_unref_object GFile *dir = NULL; + gs_unref_object GFile *temp_file = NULL; + gs_unref_object GFileInfo *temp_info = NULL; if (mode == OSTREE_REPO_CHECKOUT_MODE_USER) { @@ -3378,7 +3378,7 @@ checkout_file_hardlink (OstreeRepo *self, { gboolean ret = FALSE; gboolean ret_was_supported = FALSE; - ot_lobj GFile *dir = NULL; + gs_unref_object GFile *dir = NULL; again: if (dirfd != -1 && @@ -3429,7 +3429,7 @@ find_loose_for_checkout (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - ot_lobj GFile *path = NULL; + gs_unref_object GFile *path = NULL; struct stat stbuf; do @@ -3530,9 +3530,9 @@ checkout_file_thread (GSimpleAsyncResult *result, gboolean hardlink_supported; GError *local_error = NULL; GError **error = &local_error; - ot_lobj GFile *loose_path = NULL; - ot_lobj GInputStream *input = NULL; - ot_lvariant GVariant *xattrs = NULL; + gs_unref_object GFile *loose_path = NULL; + gs_unref_object GInputStream *input = NULL; + gs_unref_variant GVariant *xattrs = NULL; CheckoutOneFileAsyncData *checkout_data; checkout_data = g_simple_async_result_get_op_res_gpointer (result); @@ -3566,7 +3566,7 @@ checkout_file_thread (GSimpleAsyncResult *result, && checkout_data->mode == OSTREE_REPO_CHECKOUT_MODE_USER && repo->enable_uncompressed_cache) { - ot_lobj GFile *objdir = NULL; + gs_unref_object GFile *objdir = NULL; loose_path = get_uncompressed_object_cache_path (repo, checksum); if (!ostree_repo_load_file (repo, checksum, &input, NULL, &xattrs, @@ -3814,8 +3814,8 @@ process_pending_dirs (CheckoutTreeAsyncData *data) { GFileInfo *file_info = data->pending_dirs->pdata[i]; const char *name; - ot_lobj GFile *dest_path = NULL; - ot_lobj GFile *src_child = NULL; + gs_unref_object GFile *dest_path = NULL; + gs_unref_object GFile *src_child = NULL; name = g_file_info_get_attribute_byte_string (file_info, "standard::name"); @@ -3892,8 +3892,8 @@ on_got_next_files (GObject *src, if (type != G_FILE_TYPE_DIRECTORY) { - ot_lobj GFile *dest_path = NULL; - ot_lobj GFile *src_child = NULL; + gs_unref_object GFile *dest_path = NULL; + gs_unref_object GFile *src_child = NULL; dest_path = g_file_get_child (data->destination, name); src_child = g_file_get_child ((GFile*)data->source, name); @@ -3937,9 +3937,9 @@ ostree_repo_checkout_tree_async (OstreeRepo *self, gpointer user_data) { CheckoutTreeAsyncData *checkout_data; - ot_lobj GFileInfo *file_info = NULL; - ot_lvariant GVariant *xattrs = NULL; - ot_lobj GFileEnumerator *dir_enum = NULL; + gs_unref_object GFileInfo *file_info = NULL; + gs_unref_variant GVariant *xattrs = NULL; + gs_unref_object GFileEnumerator *dir_enum = NULL; GError *local_error = NULL; GError **error = &local_error; @@ -4024,7 +4024,7 @@ ostree_repo_checkout_gc (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - ot_lhash GHashTable *to_clean_dirs = NULL; + gs_unref_hashtable GHashTable *to_clean_dirs = NULL; GHashTableIter iter; gpointer key, value; @@ -4037,9 +4037,9 @@ ostree_repo_checkout_gc (OstreeRepo *self, g_hash_table_iter_init (&iter, to_clean_dirs); while (to_clean_dirs && g_hash_table_iter_next (&iter, &key, &value)) { - ot_lobj GFile *objdir = NULL; - ot_lobj GFileEnumerator *enumerator = NULL; - ot_lfree char *objdir_name = NULL; + gs_unref_object GFile *objdir = NULL; + gs_unref_object GFileEnumerator *enumerator = NULL; + gs_free char *objdir_name = NULL; objdir_name = g_strdup_printf ("%02x", GPOINTER_TO_UINT (key)); objdir = ot_gfile_get_child_build_path (self->uncompressed_objects_dir, "objects", @@ -4087,8 +4087,8 @@ ostree_repo_read_commit (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - ot_lobj GFile *ret_root = NULL; - ot_lfree char *resolved_rev = NULL; + gs_unref_object GFile *ret_root = NULL; + gs_free char *resolved_rev = NULL; if (!ostree_repo_resolve_rev (self, rev, FALSE, &resolved_rev, error)) goto out; diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index ea13cf71..2517c551 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -59,9 +59,9 @@ ostree_run_triggers_in_root (GFile *root, { gboolean ret = FALSE; int estatus; - ot_lfree char *rel_triggerdir = NULL; - ot_lobj GFile *triggerdir = NULL; - ot_lptrarray GPtrArray *argv = NULL; + gs_free char *rel_triggerdir = NULL; + gs_unref_object GFile *triggerdir = NULL; + gs_unref_ptrarray GPtrArray *argv = NULL; rel_triggerdir = g_build_filename ("usr", "libexec", "ostree", "triggers.d", NULL); diff --git a/src/libostree/ostree-traverse.c b/src/libostree/ostree-traverse.c index 20f75865..88691710 100644 --- a/src/libostree/ostree-traverse.c +++ b/src/libostree/ostree-traverse.c @@ -44,14 +44,14 @@ traverse_dirtree_internal (OstreeRepo *repo, { gboolean ret = FALSE; int n, i; - ot_lvariant GVariant *key = NULL; - ot_lvariant GVariant *tree = NULL; - ot_lvariant GVariant *files_variant = NULL; - ot_lvariant GVariant *dirs_variant = NULL; - ot_lvariant GVariant *csum_v = NULL; - ot_lvariant GVariant *content_csum_v = NULL; - ot_lvariant GVariant *metadata_csum_v = NULL; - ot_lfree char *tmp_checksum = NULL; + gs_unref_variant GVariant *key = NULL; + gs_unref_variant GVariant *tree = NULL; + gs_unref_variant GVariant *files_variant = NULL; + gs_unref_variant GVariant *dirs_variant = NULL; + gs_unref_variant GVariant *csum_v = NULL; + gs_unref_variant GVariant *content_csum_v = NULL; + gs_unref_variant GVariant *metadata_csum_v = NULL; + gs_free char *tmp_checksum = NULL; if (recursion_depth > OSTREE_MAX_RECURSION) { @@ -144,16 +144,16 @@ ostree_traverse_commit (OstreeRepo *repo, GError **error) { gboolean ret = FALSE; - ot_lfree char*tmp_checksum = NULL; + gs_free char*tmp_checksum = NULL; while (TRUE) { gboolean recurse = FALSE; - ot_lvariant GVariant *parent_csum_bytes = NULL; - ot_lvariant GVariant *meta_csum_bytes = NULL; - ot_lvariant GVariant *content_csum_bytes = NULL; - ot_lvariant GVariant *key = NULL; - ot_lvariant GVariant *commit = NULL; + gs_unref_variant GVariant *parent_csum_bytes = NULL; + gs_unref_variant GVariant *meta_csum_bytes = NULL; + gs_unref_variant GVariant *content_csum_bytes = NULL; + gs_unref_variant GVariant *key = NULL; + gs_unref_variant GVariant *commit = NULL; key = ostree_object_name_serialize (commit_checksum, OSTREE_OBJECT_TYPE_COMMIT); diff --git a/src/libotutil/ot-checksum-utils.c b/src/libotutil/ot-checksum-utils.c index bc4deaed..6a45c01b 100644 --- a/src/libotutil/ot-checksum-utils.c +++ b/src/libotutil/ot-checksum-utils.c @@ -112,7 +112,7 @@ ot_gio_splice_get_checksum (GOutputStream *out, { gboolean ret = FALSE; GChecksum *checksum = NULL; - ot_lfree guchar *ret_csum = NULL; + gs_free guchar *ret_csum = NULL; checksum = g_checksum_new (G_CHECKSUM_SHA256); diff --git a/src/libotutil/ot-gio-utils.c b/src/libotutil/ot-gio-utils.c index 49d1a51a..f250f15e 100644 --- a/src/libotutil/ot-gio-utils.c +++ b/src/libotutil/ot-gio-utils.c @@ -55,8 +55,8 @@ ot_gfile_from_build_path (const char *first, ...) { va_list args; const char *arg; - ot_lfree char *path = NULL; - ot_lptrarray GPtrArray *components = NULL; + gs_free char *path = NULL; + gs_unref_ptrarray GPtrArray *components = NULL; va_start (args, first); @@ -110,8 +110,8 @@ ot_gfile_get_child_build_path (GFile *parent, { va_list args; const char *arg; - ot_lfree char *path = NULL; - ot_lptrarray GPtrArray *components = NULL; + gs_free char *path = NULL; + gs_unref_ptrarray GPtrArray *components = NULL; va_start (args, first); diff --git a/src/libotutil/ot-keyfile-utils.c b/src/libotutil/ot-keyfile-utils.c index 30014fad..f7d8cc1d 100644 --- a/src/libotutil/ot-keyfile-utils.c +++ b/src/libotutil/ot-keyfile-utils.c @@ -69,7 +69,7 @@ ot_keyfile_get_value_with_default (GKeyFile *keyfile, { gboolean ret = FALSE; GError *temp_error = NULL; - ot_lfree char *ret_value; + gs_free char *ret_value; ret_value = g_key_file_get_value (keyfile, section, value, &temp_error); if (temp_error) diff --git a/src/libotutil/ot-local-alloc.h b/src/libotutil/ot-local-alloc.h deleted file mode 100644 index ee3b93f4..00000000 --- a/src/libotutil/ot-local-alloc.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2011 Colin Walters <walters@verbum.org>. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Colin Walters <walters@verbum.org> - */ - -#ifndef __OSTREE_LOCAL_ALLOC_H__ -#define __OSTREE_LOCAL_ALLOC_H__ - -#include <gio/gio.h> -#include "libgsystem.h" - -G_BEGIN_DECLS - -#define ot_lfree __attribute__ ((cleanup(gs_local_free))) -#define ot_lobj __attribute__ ((cleanup(gs_local_obj_unref))) -#define ot_lvariant __attribute__ ((cleanup(gs_local_variant_unref))) -#define ot_lptrarray __attribute__ ((cleanup(gs_local_ptrarray_unref))) -#define ot_lhash __attribute__ ((cleanup(gs_local_hashtable_unref))) - -G_END_DECLS - -#endif diff --git a/src/libotutil/ot-unix-utils.c b/src/libotutil/ot-unix-utils.c index 032b497a..54c5ac14 100644 --- a/src/libotutil/ot-unix-utils.c +++ b/src/libotutil/ot-unix-utils.c @@ -47,7 +47,7 @@ ot_util_spawn_pager (GOutputStream **out_stream, char *argv[2]; int stdin_fd; pid_t pid; - ot_lfree GOutputStream *ret_stream = NULL; + gs_free GOutputStream *ret_stream = NULL; if (!isatty (1)) { @@ -134,7 +134,7 @@ ot_util_path_split_validate (const char *path, { gboolean ret = FALSE; int i; - ot_lptrarray GPtrArray *ret_components = NULL; + gs_unref_ptrarray GPtrArray *ret_components = NULL; if (strlen (path) > PATH_MAX) { diff --git a/src/libotutil/ot-variant-utils.c b/src/libotutil/ot-variant-utils.c index 31d01b52..4255a102 100644 --- a/src/libotutil/ot-variant-utils.c +++ b/src/libotutil/ot-variant-utils.c @@ -66,7 +66,7 @@ ot_util_variant_save (GFile *dest, GError **error) { gboolean ret = FALSE; - ot_lobj GOutputStream *out = NULL; + gs_unref_object GOutputStream *out = NULL; gsize bytes_written; out = (GOutputStream*)g_file_replace (dest, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, @@ -109,7 +109,7 @@ ot_util_variant_map (GFile *src, GError **error) { gboolean ret = FALSE; - ot_lvariant GVariant *ret_variant = NULL; + gs_unref_variant GVariant *ret_variant = NULL; GMappedFile *mfile = NULL; mfile = gs_file_map_noatime (src, NULL, error); @@ -148,8 +148,8 @@ ot_util_variant_from_stream (GInputStream *src, GError **error) { gboolean ret = FALSE; - ot_lobj GMemoryOutputStream *data_stream = NULL; - ot_lvariant GVariant *ret_variant = NULL; + gs_unref_object GMemoryOutputStream *data_stream = NULL; + gs_unref_variant GVariant *ret_variant = NULL; data_stream = (GMemoryOutputStream*)g_memory_output_stream_new (NULL, 0, g_realloc, g_free); diff --git a/src/libotutil/otutil.h b/src/libotutil/otutil.h index 53071bc7..014e7fc2 100644 --- a/src/libotutil/otutil.h +++ b/src/libotutil/otutil.h @@ -38,7 +38,6 @@ } G_STMT_END; #include <ot-waitable-queue.h> -#include <ot-local-alloc.h> #include <ot-keyfile-utils.h> #include <ot-gio-utils.h> #include <ot-opt-utils.h> diff --git a/src/ostree/ostree-fetcher.c b/src/ostree/ostree-fetcher.c index cb621310..045ff3f7 100644 --- a/src/ostree/ostree-fetcher.c +++ b/src/ostree/ostree-fetcher.c @@ -167,7 +167,7 @@ on_splice_complete (GObject *object, gpointer user_data) { OstreeFetcherPendingURI *pending = user_data; - ot_lobj GFileInfo *file_info = NULL; + gs_unref_object GFileInfo *file_info = NULL; pending->state = OSTREE_FETCHER_STATE_COMPLETE; file_info = g_file_query_info (pending->tmpfile, OSTREE_GIO_FAST_QUERYINFO, @@ -332,14 +332,14 @@ ostree_fetcher_query_state_text (OstreeFetcher *self) if (active->tmpfile) { - ot_lobj GFileInfo *file_info = NULL; + gs_unref_object GFileInfo *file_info = NULL; file_info = g_file_query_info (active->tmpfile, OSTREE_GIO_FAST_QUERYINFO, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, NULL); if (file_info) { - ot_lfree char *size = format_size_pair (g_file_info_get_size (file_info), + gs_free char *size = format_size_pair (g_file_info_get_size (file_info), active->content_length); g_string_append_printf (buf, " [%s]", size); } diff --git a/src/ostree/ostree-prune.c b/src/ostree/ostree-prune.c index fb0c485f..beaf2069 100644 --- a/src/ostree/ostree-prune.c +++ b/src/ostree/ostree-prune.c @@ -43,8 +43,8 @@ maybe_prune_loose_object (OtPruneData *data, GError **error) { gboolean ret = FALSE; - ot_lvariant GVariant *key = NULL; - ot_lobj GFile *objf = NULL; + gs_unref_variant GVariant *key = NULL; + gs_unref_object GFile *objf = NULL; key = ostree_object_name_serialize (checksum, objtype); @@ -54,7 +54,7 @@ maybe_prune_loose_object (OtPruneData *data, { if (!(flags & OSTREE_PRUNE_FLAGS_NO_PRUNE)) { - ot_lobj GFileInfo *info = NULL; + gs_unref_object GFileInfo *info = NULL; if ((info = g_file_query_info (objf, OSTREE_GIO_FAST_QUERYINFO, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, diff --git a/src/ostree/ostree-pull.c b/src/ostree/ostree-pull.c index 20a025e3..16af0720 100644 --- a/src/ostree/ostree-pull.c +++ b/src/ostree/ostree-pull.c @@ -198,7 +198,7 @@ static gboolean uri_fetch_update_status (gpointer user_data) { OtPullData *pull_data = user_data; - ot_lfree char *fetcher_status = NULL; + gs_free char *fetcher_status = NULL; GString *status; guint64 current_bytes_transferred; guint64 current_delta_bytes_transferred; @@ -388,8 +388,8 @@ fetch_uri (OtPullData *pull_data, GError **error) { gboolean ret = FALSE; - ot_lfree char *uri_string = NULL; - ot_lobj SoupRequest *request = NULL; + gs_free char *uri_string = NULL; + gs_unref_object SoupRequest *request = NULL; OstreeFetchUriData fetch_data; if (g_cancellable_set_error_if_cancelled (cancellable, error)) @@ -421,8 +421,8 @@ fetch_uri_contents_utf8 (OtPullData *pull_data, GError **error) { gboolean ret = FALSE; - ot_lobj GFile *tmpf = NULL; - ot_lfree char *ret_contents = NULL; + gs_unref_object GFile *tmpf = NULL; + gs_free char *ret_contents = NULL; gsize len; if (!fetch_uri (pull_data, uri, "tmp-", &tmpf, cancellable, error)) @@ -455,10 +455,10 @@ scan_dirtree_object (OtPullData *pull_data, { gboolean ret = FALSE; int i, n; - ot_lvariant GVariant *tree = NULL; - ot_lvariant GVariant *files_variant = NULL; - ot_lvariant GVariant *dirs_variant = NULL; - ot_lobj GFile *stored_path = NULL; + gs_unref_variant GVariant *tree = NULL; + gs_unref_variant GVariant *files_variant = NULL; + gs_unref_variant GVariant *dirs_variant = NULL; + gs_unref_object GFile *stored_path = NULL; if (recursion_depth > OSTREE_MAX_RECURSION) { @@ -480,8 +480,8 @@ scan_dirtree_object (OtPullData *pull_data, { const char *filename; gboolean file_is_stored; - ot_lvariant GVariant *csum = NULL; - ot_lfree char *file_checksum; + gs_unref_variant GVariant *csum = NULL; + gs_free char *file_checksum; g_variant_get_child (files_variant, i, "(&s@ay)", &filename, &csum); @@ -509,9 +509,9 @@ scan_dirtree_object (OtPullData *pull_data, for (i = 0; i < n; i++) { const char *dirname; - ot_lvariant GVariant *tree_csum = NULL; - ot_lvariant GVariant *meta_csum = NULL; - ot_lfree char *tmp_checksum = NULL; + gs_unref_variant GVariant *tree_csum = NULL; + gs_unref_variant GVariant *meta_csum = NULL; + gs_free char *tmp_checksum = NULL; g_variant_get_child (dirs_variant, i, "(&s@ay@ay)", &dirname, &tree_csum, &meta_csum); @@ -543,7 +543,7 @@ fetch_ref_contents (OtPullData *pull_data, GError **error) { gboolean ret = FALSE; - ot_lfree char *ret_contents = NULL; + gs_free char *ret_contents = NULL; SoupURI *target_uri = NULL; target_uri = suburi_new (pull_data->base_uri, "refs", "heads", ref, NULL); @@ -575,8 +575,8 @@ content_fetch_on_stage_complete (GObject *object, GError **error = &local_error; OstreeObjectType objtype; const char *expected_checksum; - ot_lfree guchar *csum = NULL; - ot_lfree char *checksum = NULL; + gs_free guchar *csum = NULL; + gs_free char *checksum = NULL; if (!ostree_repo_stage_content_finish ((OstreeRepo*)object, result, &csum, error)) @@ -612,13 +612,13 @@ content_fetch_on_complete (GObject *object, GError **error = &local_error; GCancellable *cancellable = NULL; guint64 length; - ot_lvariant GVariant *file_meta = NULL; - ot_lobj GFileInfo *file_info = NULL; - ot_lobj GInputStream *content_input = NULL; - ot_lobj GInputStream *file_object_input = NULL; - ot_lvariant GVariant *xattrs = NULL; - ot_lobj GInputStream *file_in = NULL; - ot_lobj GInputStream *object_input = NULL; + gs_unref_variant GVariant *file_meta = NULL; + gs_unref_object GFileInfo *file_info = NULL; + gs_unref_object GInputStream *content_input = NULL; + gs_unref_object GInputStream *file_object_input = NULL; + gs_unref_variant GVariant *xattrs = NULL; + gs_unref_object GInputStream *file_in = NULL; + gs_unref_object GInputStream *object_input = NULL; const char *checksum; OstreeObjectType objtype; @@ -700,7 +700,7 @@ meta_fetch_on_complete (GObject *object, { FetchObjectData *fetch_data = user_data; OtPullData *pull_data = fetch_data->pull_data; - ot_lvariant GVariant *metadata = NULL; + gs_unref_variant GVariant *metadata = NULL; const char *checksum; OstreeObjectType objtype; GError *local_error = NULL; @@ -742,11 +742,11 @@ scan_commit_object (OtPullData *pull_data, GError **error) { gboolean ret = FALSE; - ot_lvariant GVariant *commit = NULL; - ot_lvariant GVariant *related_objects = NULL; - ot_lvariant GVariant *tree_contents_csum = NULL; - ot_lvariant GVariant *tree_meta_csum = NULL; - ot_lfree char *tmp_checksum = NULL; + gs_unref_variant GVariant *commit = NULL; + gs_unref_variant GVariant *related_objects = NULL; + gs_unref_variant GVariant *tree_contents_csum = NULL; + gs_unref_variant GVariant *tree_meta_csum = NULL; + gs_free char *tmp_checksum = NULL; GVariantIter *iter = NULL; if (recursion_depth > OSTREE_MAX_RECURSION) @@ -777,7 +777,7 @@ scan_commit_object (OtPullData *pull_data, if (opt_related) { const char *name; - ot_lvariant GVariant *csum_v = NULL; + gs_unref_variant GVariant *csum_v = NULL; related_objects = g_variant_get_child_value (commit, 2); iter = g_variant_iter_new (related_objects); @@ -807,8 +807,8 @@ scan_one_metadata_object (OtPullData *pull_data, GError **error) { gboolean ret = FALSE; - ot_lvariant GVariant *object = NULL; - ot_lfree char *tmp_checksum = NULL; + gs_unref_variant GVariant *object = NULL; + gs_free char *tmp_checksum = NULL; gboolean is_requested; gboolean is_stored; @@ -869,7 +869,7 @@ scan_one_metadata_object_v_name (OtPullData *pull_data, { OstreeObjectType objtype; const char *checksum = NULL; - ot_lfree guchar *csum = NULL; + gs_free guchar *csum = NULL; ostree_object_name_deserialize (object, &checksum, &objtype); csum = ostree_checksum_to_bytes (checksum); @@ -1054,7 +1054,7 @@ parse_ref_summary (const char *contents, GError **error) { gboolean ret = FALSE; - ot_lhash GHashTable *ret_refs = NULL; + gs_unref_hashtable GHashTable *ret_refs = NULL; char **lines = NULL; char **iter = NULL; char *ref = NULL; @@ -1112,7 +1112,7 @@ repo_get_string_key_inherit (OstreeRepo *repo, gboolean ret = FALSE; GError *temp_error = NULL; GKeyFile *config; - ot_lfree char *ret_value = NULL; + gs_free char *ret_value = NULL; config = ostree_repo_get_config (repo); @@ -1148,7 +1148,7 @@ load_remote_repo_config (OtPullData *pull_data, GError **error) { gboolean ret = FALSE; - ot_lfree char *contents = NULL; + gs_free char *contents = NULL; GKeyFile *ret_keyfile = NULL; SoupURI *target_uri = NULL; @@ -1180,17 +1180,17 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error) gpointer key, value; int i; GCancellable *cancellable = NULL; - ot_lfree char *remote_key = NULL; - ot_lobj OstreeRepo *repo = NULL; - ot_lfree char *remote_config_content = NULL; - ot_lfree char *path = NULL; - ot_lfree char *baseurl = NULL; - ot_lfree char *summary_data = NULL; - ot_lhash GHashTable *requested_refs_to_fetch = NULL; - ot_lhash GHashTable *updated_refs = NULL; - ot_lhash GHashTable *commits_to_fetch = NULL; - ot_lfree char *branch_rev = NULL; - ot_lfree char *remote_mode_str = NULL; + gs_free char *remote_key = NULL; + gs_unref_object OstreeRepo *repo = NULL; + gs_free char *remote_config_content = NULL; + gs_free char *path = NULL; + gs_free char *baseurl = NULL; + gs_free char *summary_data = NULL; + gs_unref_hashtable GHashTable *requested_refs_to_fetch = NULL; + gs_unref_hashtable GHashTable *updated_refs = NULL; + gs_unref_hashtable GHashTable *commits_to_fetch = NULL; + gs_free char *branch_rev = NULL; + gs_free char *remote_mode_str = NULL; OtPullData pull_data_real; OtPullData *pull_data = &pull_data_real; SoupURI *summary_uri = NULL; @@ -1369,10 +1369,10 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error) { const char *ref = key; const char *sha256 = value; - ot_lfree char *key = NULL; - ot_lfree char *remote_ref = NULL; - ot_lfree char *baseurl = NULL; - ot_lfree char *original_rev = NULL; + gs_free char *key = NULL; + gs_free char *remote_ref = NULL; + gs_free char *baseurl = NULL; + gs_free char *original_rev = NULL; remote_ref = g_strdup_printf ("%s/%s", pull_data->remote_name, ref); @@ -1416,7 +1416,7 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error) { const char *ref = key; const char *checksum = value; - ot_lfree char *remote_ref = NULL; + gs_free char *remote_ref = NULL; remote_ref = g_strdup_printf ("%s/%s", pull_data->remote_name, ref); diff --git a/src/ostree/ot-admin-builtin-diff.c b/src/ostree/ot-admin-builtin-diff.c index 97fb16aa..fd4cd58a 100644 --- a/src/ostree/ot-admin-builtin-diff.c +++ b/src/ostree/ot-admin-builtin-diff.c @@ -41,16 +41,16 @@ ot_admin_builtin_diff (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GE GOptionContext *context; gboolean ret = FALSE; gs_free char *booted_osname = NULL; - ot_lobj GFile *repo_path = NULL; + gs_unref_object GFile *repo_path = NULL; gs_unref_object OtDeployment *deployment = NULL; gs_unref_object GFile *deployment_dir = NULL; - ot_lobj GFile *deploy_parent = NULL; - ot_lptrarray GPtrArray *modified = NULL; - ot_lptrarray GPtrArray *removed = NULL; - ot_lptrarray GPtrArray *added = NULL; + gs_unref_object GFile *deploy_parent = NULL; + gs_unref_ptrarray GPtrArray *modified = NULL; + gs_unref_ptrarray GPtrArray *removed = NULL; + gs_unref_ptrarray GPtrArray *added = NULL; gs_unref_ptrarray GPtrArray *deployments = NULL; - ot_lobj GFile *orig_etc_path = NULL; - ot_lobj GFile *new_etc_path = NULL; + gs_unref_object GFile *orig_etc_path = NULL; + gs_unref_object GFile *new_etc_path = NULL; __attribute__((unused)) GCancellable *cancellable = NULL; int bootversion; diff --git a/src/ostree/ot-admin-builtin-init-fs.c b/src/ostree/ot-admin-builtin-init-fs.c index dc1a45a6..9da1e047 100644 --- a/src/ostree/ot-admin-builtin-init-fs.c +++ b/src/ostree/ot-admin-builtin-init-fs.c @@ -37,8 +37,8 @@ ot_admin_builtin_init_fs (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, { GOptionContext *context; gboolean ret = FALSE; - ot_lobj GFile *dir = NULL; - ot_lobj GFile *child = NULL; + gs_unref_object GFile *dir = NULL; + gs_unref_object GFile *child = NULL; guint i; const char *normal_toplevels[] = {"boot", "dev", "home", "proc", "run", "sys"}; GCancellable *cancellable = NULL; diff --git a/src/ostree/ot-admin-builtin-install.c b/src/ostree/ot-admin-builtin-install.c index 675f52c6..0d912b3d 100644 --- a/src/ostree/ot-admin-builtin-install.c +++ b/src/ostree/ot-admin-builtin-install.c @@ -70,14 +70,14 @@ ot_admin_builtin_install (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, gboolean ret = FALSE; const char *keyfile_arg = NULL; const char *treename_arg = NULL; - ot_lobj GFile *deploy_dir = NULL; - ot_lobj GFile *osdir = NULL; - ot_lobj GFile *dest_osconfig_path = NULL; + gs_unref_object GFile *deploy_dir = NULL; + gs_unref_object GFile *osdir = NULL; + gs_unref_object GFile *dest_osconfig_path = NULL; gs_unref_ptrarray GPtrArray *subproc_args = NULL; - ot_lfree char *osname = NULL; - ot_lfree char *repoarg = NULL; - ot_lfree char *ostree_dir_arg = NULL; - ot_lfree char *tree_to_deploy = NULL; + gs_free char *osname = NULL; + gs_free char *repoarg = NULL; + gs_free char *ostree_dir_arg = NULL; + gs_free char *tree_to_deploy = NULL; GKeyFile *keyfile = NULL; __attribute__((unused)) GCancellable *cancellable = NULL; @@ -108,8 +108,8 @@ ot_admin_builtin_install (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, if (g_str_has_prefix (keyfile_arg, "http://") || g_str_has_prefix (keyfile_arg, "https://")) { - ot_lobj GFile *tmp = g_file_new_for_path (g_get_tmp_dir ()); - ot_lobj OstreeCurlFetcher *fetcher = ostree_curl_fetcher_new (tmp); + gs_unref_object GFile *tmp = g_file_new_for_path (g_get_tmp_dir ()); + gs_unref_object OstreeCurlFetcher *fetcher = ostree_curl_fetcher_new (tmp); g_print ("Fetching %s...\n", keyfile_arg); ostree_curl_fetcher_request_uri_async (fetcher, keyfile_arg, cancellable, @@ -164,7 +164,7 @@ ot_admin_builtin_install (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, NULL); { - ot_lfree char *repourl = NULL; + gs_free char *repourl = NULL; repourl = g_key_file_get_string (keyfile, "os", "Repo", error); if (!repourl) diff --git a/src/ostree/ot-admin-builtin-os-init.c b/src/ostree/ot-admin-builtin-os-init.c index 8d725fda..8bdf9708 100644 --- a/src/ostree/ot-admin-builtin-os-init.c +++ b/src/ostree/ot-admin-builtin-os-init.c @@ -38,8 +38,8 @@ ot_admin_builtin_os_init (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GOptionContext *context; gboolean ret = FALSE; const char *osname = NULL; - ot_lobj GFile *deploy_dir = NULL; - ot_lobj GFile *dir = NULL; + gs_unref_object GFile *deploy_dir = NULL; + gs_unref_object GFile *dir = NULL; __attribute__((unused)) GCancellable *cancellable = NULL; context = g_option_context_new ("OSNAME - Initialize empty state for given operating system"); diff --git a/src/ostree/ot-admin-builtin-prune.c b/src/ostree/ot-admin-builtin-prune.c index 024abd24..5ee024d4 100644 --- a/src/ostree/ot-admin-builtin-prune.c +++ b/src/ostree/ot-admin-builtin-prune.c @@ -42,11 +42,11 @@ ot_admin_builtin_prune (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, G GOptionContext *context; gboolean ret = FALSE; const char *osname; - ot_lobj GFile *repo_path = NULL; - ot_lobj GFile *deploy_dir = NULL; - ot_lobj GFile *current_deployment = NULL; - ot_lobj GFile *previous_deployment = NULL; - ot_lobj GFile *active_deployment = NULL; + gs_unref_object GFile *repo_path = NULL; + gs_unref_object GFile *deploy_dir = NULL; + gs_unref_object GFile *current_deployment = NULL; + gs_unref_object GFile *previous_deployment = NULL; + gs_unref_object GFile *active_deployment = NULL; gs_free char *active_osname = NULL; __attribute__((unused)) GCancellable *cancellable = NULL; @@ -72,7 +72,7 @@ ot_admin_builtin_prune (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, G if (!opt_no_repo_prune) { - ot_lfree char *repo_arg = NULL; + gs_free char *repo_arg = NULL; repo_arg = g_strconcat ("--repo=", gs_file_get_path_cached (repo_path), NULL); diff --git a/src/ostree/ot-admin-builtin-run-triggers.c b/src/ostree/ot-admin-builtin-run-triggers.c index 3c3df5d3..5609ee75 100644 --- a/src/ostree/ot-admin-builtin-run-triggers.c +++ b/src/ostree/ot-admin-builtin-run-triggers.c @@ -39,7 +39,7 @@ ot_admin_builtin_run_triggers (int argc, char **argv, OtAdminBuiltinOpts *admin_ { GOptionContext *context; gboolean ret = FALSE; - ot_lobj GFile *rootdir = NULL; + gs_unref_object GFile *rootdir = NULL; __attribute__((unused)) GCancellable *cancellable = NULL; context = g_option_context_new ("[ROOT] - Run triggers (regenerate caches, etc.)"); diff --git a/src/ostree/ot-admin-deploy.c b/src/ostree/ot-admin-deploy.c index f0f95577..a3fa0c33 100644 --- a/src/ostree/ot-admin-deploy.c +++ b/src/ostree/ot-admin-deploy.c @@ -75,10 +75,10 @@ copy_one_config_file (GFile *orig_etc, GError **error) { gboolean ret = FALSE; - ot_lobj GFileInfo *src_info = NULL; - ot_lobj GFile *dest = NULL; - ot_lobj GFile *parent = NULL; - ot_lfree char *relative_path = NULL; + gs_unref_object GFileInfo *src_info = NULL; + gs_unref_object GFile *dest = NULL; + gs_unref_object GFile *parent = NULL; + gs_free char *relative_path = NULL; relative_path = g_file_get_relative_path (modified_etc, src); g_assert (relative_path); @@ -91,8 +91,8 @@ copy_one_config_file (GFile *orig_etc, if (g_file_info_get_file_type (src_info) == G_FILE_TYPE_DIRECTORY) { - ot_lobj GFileEnumerator *src_enum = NULL; - ot_lobj GFileInfo *child_info = NULL; + gs_unref_object GFileEnumerator *src_enum = NULL; + gs_unref_object GFileInfo *child_info = NULL; GError *temp_error = NULL; /* FIXME actually we need to copy permissions and xattrs */ @@ -105,7 +105,7 @@ copy_one_config_file (GFile *orig_etc, while ((child_info = g_file_enumerator_next_file (src_enum, cancellable, error)) != NULL) { - ot_lobj GFile *child = g_file_get_child (src, g_file_info_get_name (child_info)); + gs_unref_object GFile *child = g_file_get_child (src, g_file_info_get_name (child_info)); if (!copy_one_config_file (orig_etc, modified_etc, new_etc, child, cancellable, error)) @@ -161,11 +161,11 @@ merge_etc_changes (GFile *orig_etc, GError **error) { gboolean ret = FALSE; - ot_lobj GFile *ostree_etc = NULL; - ot_lobj GFile *tmp_etc = NULL; - ot_lptrarray GPtrArray *modified = NULL; - ot_lptrarray GPtrArray *removed = NULL; - ot_lptrarray GPtrArray *added = NULL; + gs_unref_object GFile *ostree_etc = NULL; + gs_unref_object GFile *tmp_etc = NULL; + gs_unref_ptrarray GPtrArray *modified = NULL; + gs_unref_ptrarray GPtrArray *removed = NULL; + gs_unref_ptrarray GPtrArray *added = NULL; guint i; modified = g_ptr_array_new_with_free_func ((GDestroyNotify) ostree_diff_item_unref); @@ -190,8 +190,8 @@ merge_etc_changes (GFile *orig_etc, for (i = 0; i < removed->len; i++) { GFile *file = removed->pdata[i]; - ot_lobj GFile *target_file = NULL; - ot_lfree char *path = NULL; + gs_unref_object GFile *target_file = NULL; + gs_free char *path = NULL; path = g_file_get_relative_path (orig_etc, file); g_assert (path); diff --git a/src/ostree/ot-admin-functions.c b/src/ostree/ot-admin-functions.c index 208c2f8d..89466f19 100644 --- a/src/ostree/ot-admin-functions.c +++ b/src/ostree/ot-admin-functions.c @@ -147,7 +147,7 @@ ot_admin_ensure_initialized (GFile *sysroot, dir = ot_gfile_get_child_build_path (ostree_dir, "repo", "objects", NULL); if (!g_file_query_exists (dir, NULL)) { - ot_lfree char *opt_repo_arg = g_strdup_printf ("--repo=%s/repo", + gs_free char *opt_repo_arg = g_strdup_printf ("--repo=%s/repo", gs_file_get_path_cached (ostree_dir)); if (!gs_subprocess_simple_run_sync (NULL, GS_SUBPROCESS_STREAM_DISPOSITION_NULL, diff --git a/src/ostree/ot-builtin-cat.c b/src/ostree/ot-builtin-cat.c index 09919ebf..3169e49a 100644 --- a/src/ostree/ot-builtin-cat.c +++ b/src/ostree/ot-builtin-cat.c @@ -39,7 +39,7 @@ cat_one_file (GFile *f, GError **error) { gboolean ret = FALSE; - ot_lobj GInputStream *in = NULL; + gs_unref_object GInputStream *in = NULL; in = (GInputStream*)g_file_read (f, cancellable, error); if (!in) @@ -62,10 +62,10 @@ ostree_builtin_cat (int argc, char **argv, GFile *repo_path, GError **error) int i; GCancellable *cancellable = NULL; const char *rev; - ot_lobj OstreeRepo *repo = NULL; - ot_lobj GOutputStream *stdout_stream = NULL; - ot_lobj GFile *root = NULL; - ot_lobj GFile *f = NULL; + gs_unref_object OstreeRepo *repo = NULL; + gs_unref_object GOutputStream *stdout_stream = NULL; + gs_unref_object GFile *root = NULL; + gs_unref_object GFile *f = NULL; context = g_option_context_new ("COMMIT PATH [PATH...] - Concatenate contents of files"); g_option_context_add_main_entries (context, options, NULL); diff --git a/src/ostree/ot-builtin-checkout.c b/src/ostree/ot-builtin-checkout.c index a90795c9..d88e01ee 100644 --- a/src/ostree/ot-builtin-checkout.c +++ b/src/ostree/ot-builtin-checkout.c @@ -92,9 +92,9 @@ process_one_checkout (OstreeRepo *repo, gboolean ret = FALSE; ProcessOneCheckoutData data; GError *tmp_error = NULL; - ot_lobj OstreeRepoFile *root = NULL; - ot_lobj OstreeRepoFile *subtree = NULL; - ot_lobj GFileInfo *file_info = NULL; + gs_unref_object OstreeRepoFile *root = NULL; + gs_unref_object OstreeRepoFile *subtree = NULL; + gs_unref_object GFileInfo *file_info = NULL; memset (&data, 0, sizeof (data)); @@ -154,11 +154,11 @@ process_many_checkouts (OstreeRepo *repo, gboolean ret = FALSE; gsize len; GError *temp_error = NULL; - ot_lobj GInputStream *instream = NULL; - ot_lobj GDataInputStream *datastream = NULL; - ot_lfree char *revision = NULL; - ot_lfree char *subpath = NULL; - ot_lfree char *resolved_commit = NULL; + gs_unref_object GInputStream *instream = NULL; + gs_unref_object GDataInputStream *datastream = NULL; + gs_free char *revision = NULL; + gs_free char *subpath = NULL; + gs_free char *resolved_commit = NULL; if (opt_from_stdin) { @@ -166,7 +166,7 @@ process_many_checkouts (OstreeRepo *repo, } else { - ot_lobj GFile *f = g_file_new_for_path (opt_from_file); + gs_unref_object GFile *f = g_file_new_for_path (opt_from_file); instream = (GInputStream*)g_file_read (f, cancellable, error); if (!instream) @@ -226,14 +226,14 @@ ostree_builtin_checkout (int argc, char **argv, GFile *repo_path, GError **error gboolean ret = FALSE; const char *commit; const char *destination; - ot_lobj OstreeRepo *repo = NULL; - ot_lfree char *existing_commit = NULL; - ot_lfree char *resolved_commit = NULL; - ot_lfree char *tmp_destination = NULL; - ot_lobj GFileInfo *symlink_file_info = NULL; - ot_lobj GFile *checkout_target = NULL; - ot_lobj GFile *checkout_target_tmp = NULL; - ot_lobj GFile *symlink_target = NULL; + gs_unref_object OstreeRepo *repo = NULL; + gs_free char *existing_commit = NULL; + gs_free char *resolved_commit = NULL; + gs_free char *tmp_destination = NULL; + gs_unref_object GFileInfo *symlink_file_info = NULL; + gs_unref_object GFile *checkout_target = NULL; + gs_unref_object GFile *checkout_target_tmp = NULL; + gs_unref_object GFile *symlink_target = NULL; context = g_option_context_new ("COMMIT DESTINATION - Check out a commit into a filesystem tree"); g_option_context_add_main_entries (context, options, NULL); diff --git a/src/ostree/ot-builtin-checksum.c b/src/ostree/ot-builtin-checksum.c index 64f35cad..150a24f1 100644 --- a/src/ostree/ot-builtin-checksum.c +++ b/src/ostree/ot-builtin-checksum.c @@ -41,8 +41,8 @@ on_checksum_received (GObject *obj, GAsyncResult *result, gpointer user_data) { - ot_lfree guchar *csum = NULL; - ot_lfree char *checksum = NULL; + gs_free guchar *csum = NULL; + gs_free char *checksum = NULL; AsyncChecksumData *data = user_data; if (ostree_checksum_file_async_finish ((GFile*)obj, result, &csum, data->error)) @@ -59,7 +59,7 @@ ostree_builtin_checksum (int argc, char **argv, GFile *repo_path_path, GError ** { GOptionContext *context; gboolean ret = FALSE; - ot_lobj GFile *f = NULL; + gs_unref_object GFile *f = NULL; AsyncChecksumData data; context = g_option_context_new ("FILENAME - Checksum a file or directory"); diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c index 96a41ebb..f01815b7 100644 --- a/src/ostree/ot-builtin-commit.c +++ b/src/ostree/ot-builtin-commit.c @@ -72,9 +72,9 @@ parse_statoverride_file (GHashTable **out_mode_add, gboolean ret = FALSE; gsize len; char **iter = NULL; /* nofree */ - ot_lhash GHashTable *ret_hash = NULL; - ot_lobj GFile *path = NULL; - ot_lfree char *contents = NULL; + gs_unref_hashtable GHashTable *ret_hash = NULL; + gs_unref_object GFile *path = NULL; + gs_free char *contents = NULL; char **lines = NULL; path = g_file_new_for_path (statoverride_file); @@ -125,10 +125,10 @@ parse_related_objects_file (GVariant **out_related_objects, gboolean ret = FALSE; gsize len; char **iter = NULL; /* nofree */ - ot_lhash GHashTable *ret_hash = NULL; - ot_lvariant GVariant *ret_related_objects = NULL; - ot_lobj GFile *path = NULL; - ot_lfree char *contents = NULL; + gs_unref_hashtable GHashTable *ret_hash = NULL; + gs_unref_variant GVariant *ret_related_objects = NULL; + gs_unref_object GFile *path = NULL; + gs_free char *contents = NULL; GVariantBuilder builder; gboolean builder_initialized = FALSE; char **lines = NULL; @@ -148,7 +148,7 @@ parse_related_objects_file (GVariant **out_related_objects, { const char *line = *iter; const char *spc; - ot_lfree char *name = NULL; + gs_free char *name = NULL; if (!*line) break; @@ -219,22 +219,22 @@ ostree_builtin_commit (int argc, char **argv, GFile *repo_path, GError **error) gboolean skip_commit = FALSE; gboolean in_transaction = FALSE; GCancellable *cancellable = NULL; - ot_lobj OstreeRepo *repo = NULL; - ot_lobj GFile *arg = NULL; - ot_lfree char *parent = NULL; - ot_lfree char *commit_checksum = NULL; - ot_lvariant GVariant *parent_commit = NULL; - ot_lvariant GVariant *metadata = NULL; - ot_lvariant GVariant *related_objects = NULL; - ot_lobj GFile *metadata_f = NULL; - ot_lfree char *contents_checksum = NULL; - ot_lobj OstreeMutableTree *mtree = NULL; - ot_lfree char *tree_type = NULL; - ot_lhash GHashTable *mode_adds = NULL; - ot_lvariant GVariant *parent_content_csum_v = NULL; - ot_lvariant GVariant *parent_metadata_csum_v = NULL; - ot_lfree char *parent_content_checksum = NULL; - ot_lfree char *parent_metadata_checksum = NULL; + gs_unref_object OstreeRepo *repo = NULL; + gs_unref_object GFile *arg = NULL; + gs_free char *parent = NULL; + gs_free char *commit_checksum = NULL; + gs_unref_variant GVariant *parent_commit = NULL; + gs_unref_variant GVariant *metadata = NULL; + gs_unref_variant GVariant *related_objects = NULL; + gs_unref_object GFile *metadata_f = NULL; + gs_free char *contents_checksum = NULL; + gs_unref_object OstreeMutableTree *mtree = NULL; + gs_free char *tree_type = NULL; + gs_unref_hashtable GHashTable *mode_adds = NULL; + gs_unref_variant GVariant *parent_content_csum_v = NULL; + gs_unref_variant GVariant *parent_metadata_csum_v = NULL; + gs_free char *parent_content_checksum = NULL; + gs_free char *parent_metadata_checksum = NULL; OstreeRepoCommitModifier *modifier = NULL; GMappedFile *metadata_mappedf = NULL; GVariantBuilder metadata_builder; @@ -281,7 +281,7 @@ ostree_builtin_commit (int argc, char **argv, GFile *repo_path, GError **error) { const char *s; const char *eq; - ot_lfree char *key = NULL; + gs_free char *key = NULL; s = *iter; diff --git a/src/ostree/ot-builtin-config.c b/src/ostree/ot-builtin-config.c index cac751da..2165b0c7 100644 --- a/src/ostree/ot-builtin-config.c +++ b/src/ostree/ot-builtin-config.c @@ -60,9 +60,9 @@ ostree_builtin_config (int argc, char **argv, GFile *repo_path, GError **error) const char *op; const char *section_key; const char *value; - ot_lobj OstreeRepo *repo = NULL; - ot_lfree char *section = NULL; - ot_lfree char *key = NULL; + gs_unref_object OstreeRepo *repo = NULL; + gs_free char *section = NULL; + gs_free char *key = NULL; GKeyFile *config = NULL; context = g_option_context_new ("- Change configuration settings"); @@ -107,7 +107,7 @@ ostree_builtin_config (int argc, char **argv, GFile *repo_path, GError **error) else if (!strcmp (op, "get")) { GKeyFile *readonly_config = NULL; - ot_lfree char *value = NULL; + gs_free char *value = NULL; if (argc < 3) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, diff --git a/src/ostree/ot-builtin-diff.c b/src/ostree/ot-builtin-diff.c index daa544ed..9c091d72 100644 --- a/src/ostree/ot-builtin-diff.c +++ b/src/ostree/ot-builtin-diff.c @@ -39,7 +39,7 @@ parse_file_or_commit (OstreeRepo *repo, GError **error) { gboolean ret = FALSE; - ot_lfree GFile *ret_file = NULL; + gs_free GFile *ret_file = NULL; if (g_str_has_prefix (arg, "/") || g_str_has_prefix (arg, "./") @@ -67,14 +67,14 @@ ostree_builtin_diff (int argc, char **argv, GFile *repo_path, GError **error) GCancellable *cancellable = NULL; const char *src; const char *target; - ot_lobj OstreeRepo *repo = NULL; - ot_lfree char *src_prev = NULL; - ot_lobj GFile *srcf = NULL; - ot_lobj GFile *targetf = NULL; - ot_lobj GFile *cwd = NULL; - ot_lptrarray GPtrArray *modified = NULL; - ot_lptrarray GPtrArray *removed = NULL; - ot_lptrarray GPtrArray *added = NULL; + gs_unref_object OstreeRepo *repo = NULL; + gs_free char *src_prev = NULL; + gs_unref_object GFile *srcf = NULL; + gs_unref_object GFile *targetf = NULL; + gs_unref_object GFile *cwd = NULL; + gs_unref_ptrarray GPtrArray *modified = NULL; + gs_unref_ptrarray GPtrArray *removed = NULL; + gs_unref_ptrarray GPtrArray *added = NULL; context = g_option_context_new ("REV TARGETDIR - Compare directory TARGETDIR against revision REV"); g_option_context_add_main_entries (context, options, NULL); diff --git a/src/ostree/ot-builtin-fsck.c b/src/ostree/ot-builtin-fsck.c index 9aa7b66b..822c22b5 100644 --- a/src/ostree/ot-builtin-fsck.c +++ b/src/ostree/ot-builtin-fsck.c @@ -50,13 +50,13 @@ fsck_reachable_objects_from_commits (OtFsckData *data, gboolean ret = FALSE; GHashTableIter hash_iter; gpointer key, value; - ot_lhash GHashTable *reachable_objects = NULL; - ot_lobj GInputStream *input = NULL; - ot_lobj GFileInfo *file_info = NULL; - ot_lvariant GVariant *xattrs = NULL; - ot_lvariant GVariant *metadata = NULL; - ot_lfree guchar *computed_csum = NULL; - ot_lfree char *tmp_checksum = NULL; + gs_unref_hashtable GHashTable *reachable_objects = NULL; + gs_unref_object GInputStream *input = NULL; + gs_unref_object GFileInfo *file_info = NULL; + gs_unref_variant GVariant *xattrs = NULL; + gs_unref_variant GVariant *metadata = NULL; + gs_free guchar *computed_csum = NULL; + gs_free char *tmp_checksum = NULL; reachable_objects = ostree_traverse_new_reachable (); @@ -186,9 +186,9 @@ ostree_builtin_fsck (int argc, char **argv, GFile *repo_path, GError **error) GCancellable *cancellable = NULL; GHashTableIter hash_iter; gpointer key, value; - ot_lobj OstreeRepo *repo = NULL; - ot_lhash GHashTable *objects = NULL; - ot_lhash GHashTable *commits = NULL; + gs_unref_object OstreeRepo *repo = NULL; + gs_unref_hashtable GHashTable *objects = NULL; + gs_unref_hashtable GHashTable *commits = NULL; context = g_option_context_new ("- Check the repository for consistency"); g_option_context_add_main_entries (context, options, NULL); diff --git a/src/ostree/ot-builtin-init.c b/src/ostree/ot-builtin-init.c index 8dd28217..08cf222d 100644 --- a/src/ostree/ot-builtin-init.c +++ b/src/ostree/ot-builtin-init.c @@ -47,9 +47,9 @@ ostree_builtin_init (int argc, char **argv, GFile *repo_path, GError **error) gboolean ret = FALSE; __attribute__ ((unused)) GCancellable *cancellable = NULL; const char *mode_str = "bare"; - ot_lobj GFile *child = NULL; - ot_lobj GFile *grandchild = NULL; - ot_lobj OstreeRepo *repo = NULL; + gs_unref_object GFile *child = NULL; + gs_unref_object GFile *grandchild = NULL; + gs_unref_object OstreeRepo *repo = NULL; GString *config_data = NULL; context = g_option_context_new ("- Initialize a new empty repository"); diff --git a/src/ostree/ot-builtin-log.c b/src/ostree/ot-builtin-log.c index e3523052..ebc30e11 100644 --- a/src/ostree/ot-builtin-log.c +++ b/src/ostree/ot-builtin-log.c @@ -37,10 +37,10 @@ ostree_builtin_log (int argc, char **argv, GFile *repo_path, GError **error) GOptionContext *context; gboolean ret = FALSE; const char *rev; - ot_lobj OstreeRepo *repo = NULL; - ot_lobj GOutputStream *pager = NULL; - ot_lvariant GVariant *commit = NULL; - ot_lfree char *resolved_rev = NULL; + gs_unref_object OstreeRepo *repo = NULL; + gs_unref_object GOutputStream *pager = NULL; + gs_unref_variant GVariant *commit = NULL; + gs_free char *resolved_rev = NULL; context = g_option_context_new ("- Show revision log"); g_option_context_add_main_entries (context, options, NULL); diff --git a/src/ostree/ot-builtin-ls.c b/src/ostree/ot-builtin-ls.c index 73589ee9..4e08181d 100644 --- a/src/ostree/ot-builtin-ls.c +++ b/src/ostree/ot-builtin-ls.c @@ -151,9 +151,9 @@ print_directory_recurse (GFile *f, GError **error) { gboolean ret = FALSE; - ot_lobj GFileEnumerator *dir_enum = NULL; - ot_lobj GFile *child = NULL; - ot_lobj GFileInfo *child_info = NULL; + gs_unref_object GFileEnumerator *dir_enum = NULL; + gs_unref_object GFile *child = NULL; + gs_unref_object GFileInfo *child_info = NULL; GError *temp_error = NULL; dir_enum = g_file_enumerate_children (f, OSTREE_GIO_FAST_QUERYINFO, @@ -194,12 +194,12 @@ ostree_builtin_ls (int argc, char **argv, GFile *repo_path, GError **error) { GOptionContext *context; gboolean ret = FALSE; - ot_lobj OstreeRepo *repo = NULL; + gs_unref_object OstreeRepo *repo = NULL; const char *rev; int i; - ot_lobj GFile *root = NULL; - ot_lobj GFile *f = NULL; - ot_lobj GFileInfo *file_info = NULL; + gs_unref_object GFile *root = NULL; + gs_unref_object GFile *f = NULL; + gs_unref_object GFileInfo *file_info = NULL; context = g_option_context_new ("COMMIT PATH [PATH...] - List file paths"); g_option_context_add_main_entries (context, options, NULL); diff --git a/src/ostree/ot-builtin-pull-local.c b/src/ostree/ot-builtin-pull-local.c index ed1b6629..edb19b99 100644 --- a/src/ostree/ot-builtin-pull-local.c +++ b/src/ostree/ot-builtin-pull-local.c @@ -60,16 +60,16 @@ import_one_object (OtLocalCloneData *data, GError **error) { gboolean ret = FALSE; - ot_lobj GFile *content_path = NULL; - ot_lobj GFileInfo *archive_info = NULL; + gs_unref_object GFile *content_path = NULL; + gs_unref_object GFileInfo *archive_info = NULL; if (objtype == OSTREE_OBJECT_TYPE_FILE) { guint64 length; - ot_lobj GInputStream *file_object = NULL; - ot_lobj GInputStream *input = NULL; - ot_lobj GFileInfo *file_info = NULL; - ot_lvariant GVariant *xattrs = NULL; + gs_unref_object GInputStream *file_object = NULL; + gs_unref_object GInputStream *input = NULL; + gs_unref_object GFileInfo *file_info = NULL; + gs_unref_variant GVariant *xattrs = NULL; if (!ostree_repo_load_file (data->src_repo, checksum, &input, &file_info, &xattrs, @@ -88,7 +88,7 @@ import_one_object (OtLocalCloneData *data, } else { - ot_lvariant GVariant *metadata = NULL; + gs_unref_variant GVariant *metadata = NULL; if (!ostree_repo_load_variant (data->src_repo, objtype, checksum, &metadata, error)) @@ -111,7 +111,7 @@ import_one_object_thread (gpointer object, gpointer user_data) { OtLocalCloneData *data = user_data; - ot_lvariant GVariant *serialized_key = object; + gs_unref_variant GVariant *serialized_key = object; GError *local_error = NULL; GError **error = &local_error; const char *checksum; @@ -170,16 +170,16 @@ ostree_builtin_pull_local (int argc, char **argv, GFile *repo_path, GError **err int i; GHashTableIter hash_iter; gpointer key, value; - ot_lhash GHashTable *objects = NULL; - ot_lobj GFile *src_f = NULL; - ot_lobj GFile *src_repo_dir = NULL; - ot_lobj GFile *dest_repo_dir = NULL; - ot_lobj GFile *src_dir = NULL; - ot_lobj GFile *dest_dir = NULL; - ot_lhash GHashTable *refs_to_clone = NULL; - ot_lhash GHashTable *commits_to_clone = NULL; - ot_lhash GHashTable *source_objects = NULL; - ot_lhash GHashTable *objects_to_copy = NULL; + gs_unref_hashtable GHashTable *objects = NULL; + gs_unref_object GFile *src_f = NULL; + gs_unref_object GFile *src_repo_dir = NULL; + gs_unref_object GFile *dest_repo_dir = NULL; + gs_unref_object GFile *src_dir = NULL; + gs_unref_object GFile *dest_dir = NULL; + gs_unref_hashtable GHashTable *refs_to_clone = NULL; + gs_unref_hashtable GHashTable *commits_to_clone = NULL; + gs_unref_hashtable GHashTable *source_objects = NULL; + gs_unref_hashtable GHashTable *objects_to_copy = NULL; OtLocalCloneData datav; OtLocalCloneData *data = &datav; diff --git a/src/ostree/ot-builtin-remote.c b/src/ostree/ot-builtin-remote.c index c078ab99..60398627 100644 --- a/src/ostree/ot-builtin-remote.c +++ b/src/ostree/ot-builtin-remote.c @@ -48,8 +48,8 @@ ostree_builtin_remote (int argc, char **argv, GFile *repo_path, GError **error) gboolean ret = FALSE; const char *op; guint i; - ot_lobj OstreeRepo *repo = NULL; - ot_lptrarray GPtrArray *branches = NULL; + gs_unref_object OstreeRepo *repo = NULL; + gs_unref_ptrarray GPtrArray *branches = NULL; GKeyFile *config = NULL; context = g_option_context_new ("OPERATION [args] - Control remote repository configuration"); diff --git a/src/ostree/ot-builtin-rev-parse.c b/src/ostree/ot-builtin-rev-parse.c index f34f7442..e864c7cf 100644 --- a/src/ostree/ot-builtin-rev-parse.c +++ b/src/ostree/ot-builtin-rev-parse.c @@ -38,10 +38,10 @@ ostree_builtin_rev_parse (int argc, char **argv, GFile *repo_path, GError **erro gboolean ret = FALSE; const char *rev = "master"; int i; - ot_lobj OstreeRepo *repo = NULL; - ot_lfree char *resolved_rev = NULL; - ot_lvariant GVariant *variant = NULL; - ot_lfree char *formatted_variant = NULL; + gs_unref_object OstreeRepo *repo = NULL; + gs_free char *resolved_rev = NULL; + gs_unref_variant GVariant *variant = NULL; + gs_free char *formatted_variant = NULL; context = g_option_context_new ("REV - Output the target of a rev"); g_option_context_add_main_entries (context, options, NULL); diff --git a/src/ostree/ot-builtin-show.c b/src/ostree/ot-builtin-show.c index 72b88784..b323cc3e 100644 --- a/src/ostree/ot-builtin-show.c +++ b/src/ostree/ot-builtin-show.c @@ -41,8 +41,8 @@ static GOptionEntry options[] = { static void print_variant (GVariant *variant) { - ot_lfree char *formatted_variant = NULL; - ot_lvariant GVariant *byteswapped = NULL; + gs_free char *formatted_variant = NULL; + gs_unref_variant GVariant *byteswapped = NULL; if (G_BYTE_ORDER != G_BIG_ENDIAN) { @@ -62,8 +62,8 @@ do_print_variant_generic (const GVariantType *type, GError **error) { gboolean ret = FALSE; - ot_lobj GFile *f = NULL; - ot_lvariant GVariant *variant = NULL; + gs_unref_object GFile *f = NULL; + gs_unref_variant GVariant *variant = NULL; f = g_file_new_for_path (filename); @@ -87,9 +87,9 @@ show_repo_meta (OstreeRepo *repo, char buf[8192]; gsize bytes_read; OstreeObjectType objtype; - ot_lvariant GVariant *variant = NULL; - ot_lobj GFile *object_path = NULL; - ot_lobj GInputStream *in = NULL; + gs_unref_variant GVariant *variant = NULL; + gs_unref_object GFile *object_path = NULL; + gs_unref_object GInputStream *in = NULL; for (objtype = OSTREE_OBJECT_TYPE_FILE; objtype <= OSTREE_OBJECT_TYPE_COMMIT; objtype++) { @@ -139,9 +139,9 @@ do_print_related (OstreeRepo *repo, { gboolean ret = FALSE; const char *name; - ot_lvariant GVariant *csum_v = NULL; - ot_lvariant GVariant *variant = NULL; - ot_lvariant GVariant *related = NULL; + gs_unref_variant GVariant *csum_v = NULL; + gs_unref_variant GVariant *variant = NULL; + gs_unref_variant GVariant *related = NULL; GVariantIter *viter = NULL; if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT, @@ -155,7 +155,7 @@ do_print_related (OstreeRepo *repo, while (g_variant_iter_loop (viter, "(&s@ay)", &name, &csum_v)) { - ot_lfree char *checksum = ostree_checksum_from_bytes_v (csum_v); + gs_free char *checksum = ostree_checksum_from_bytes_v (csum_v); g_print ("%s %s\n", name, checksum); } csum_v = NULL; @@ -175,8 +175,8 @@ do_print_metadata_key (OstreeRepo *repo, { gboolean ret = FALSE; const char *value; - ot_lvariant GVariant *commit = NULL; - ot_lvariant GVariant *metadata = NULL; + gs_unref_variant GVariant *commit = NULL; + gs_unref_variant GVariant *metadata = NULL; if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_COMMIT, resolved_rev, &commit, error)) @@ -201,8 +201,8 @@ ostree_builtin_show (int argc, char **argv, GFile *repo_path, GError **error) GOptionContext *context; gboolean ret = FALSE; const char *rev; - ot_lobj OstreeRepo *repo = NULL; - ot_lfree char *resolved_rev = NULL; + gs_unref_object OstreeRepo *repo = NULL; + gs_free char *resolved_rev = NULL; context = g_option_context_new ("OBJECT - Output a metadata object"); g_option_context_add_main_entries (context, options, NULL); diff --git a/src/ostree/ot-builtin-write-refs.c b/src/ostree/ot-builtin-write-refs.c index d76d847e..6422b3c6 100644 --- a/src/ostree/ot-builtin-write-refs.c +++ b/src/ostree/ot-builtin-write-refs.c @@ -42,10 +42,10 @@ ostree_builtin_write_refs (int argc, char **argv, GFile *repo_path, GError **err GCancellable *cancellable = NULL; GError *temp_error = NULL; gsize len; - ot_lobj OstreeRepo *repo = NULL; - ot_lobj GInputStream *instream = NULL; - ot_lobj GDataInputStream *datastream = NULL; - ot_lfree char *line = NULL; + gs_unref_object OstreeRepo *repo = NULL; + gs_unref_object GInputStream *instream = NULL; + gs_unref_object GDataInputStream *datastream = NULL; + gs_free char *line = NULL; context = g_option_context_new ("Import newline-separated pairs of REF REVISION"); g_option_context_add_main_entries (context, options, NULL); @@ -64,8 +64,8 @@ ostree_builtin_write_refs (int argc, char **argv, GFile *repo_path, GError **err cancellable, &temp_error)) != NULL) { const char *spc = strchr (line, ' '); - ot_lfree char *ref = NULL; - ot_lfree guchar *rev = NULL; + gs_free char *ref = NULL; + gs_free guchar *rev = NULL; if (!spc || spc == line) { diff --git a/src/ostree/ot-main.c b/src/ostree/ot-main.c index 43fda01c..54c2398d 100644 --- a/src/ostree/ot-main.c +++ b/src/ostree/ot-main.c @@ -181,7 +181,7 @@ ostree_run (int argc, if (!command->fn) { - ot_lfree char *msg = g_strdup_printf ("Unknown command '%s'", cmd); + gs_free char *msg = g_strdup_printf ("Unknown command '%s'", cmd); g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, msg); goto out; } |