[ostree] Use g_autoptr() for GIO object types



commit 4ee1acd98109e98fd0a659f43d3187597d034f05
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon May 4 18:22:39 2015 -0400

    Use g_autoptr() for GIO object types
    
    GLib 2.44 supplies all the necessary autocleanup macros for GIO types,
    and libglnx backports the relevant macros for ostree.

 src/libostree/ostree-bootloader-grub2.c            |   20 ++--
 src/libostree/ostree-bootloader-syslinux.c         |    2 +-
 src/libostree/ostree-bootloader-uboot.c            |    2 +-
 src/libostree/ostree-core.c                        |   26 +++---
 src/libostree/ostree-diff.c                        |   18 ++--
 src/libostree/ostree-fetcher.c                     |    6 +-
 src/libostree/ostree-gpg-verifier.c                |    8 +-
 src/libostree/ostree-kernel-args.c                 |    2 +-
 src/libostree/ostree-metalink.c                    |    2 +-
 src/libostree/ostree-repo-checkout.c               |   22 +++---
 src/libostree/ostree-repo-commit.c                 |   50 ++++++------
 src/libostree/ostree-repo-file.c                   |    8 +-
 src/libostree/ostree-repo-libarchive.c             |   10 +-
 src/libostree/ostree-repo-pull.c                   |   14 ++--
 src/libostree/ostree-repo-refs.c                   |   16 ++--
 ...ostree-repo-static-delta-compilation-analysis.c |    2 +-
 .../ostree-repo-static-delta-compilation.c         |   56 ++++++------
 src/libostree/ostree-repo-static-delta-core.c      |   14 ++--
 .../ostree-repo-static-delta-processing.c          |   18 ++--
 src/libostree/ostree-repo.c                        |   54 ++++++------
 src/libostree/ostree-sepolicy.c                    |   12 ++--
 src/libostree/ostree-sysroot-cleanup.c             |   14 ++--
 src/libostree/ostree-sysroot-deploy.c              |   92 ++++++++++----------
 src/libostree/ostree-sysroot.c                     |   14 ++--
 src/libotutil/ot-checksum-utils.c                  |    2 +-
 src/libotutil/ot-gio-utils.c                       |   22 +++---
 src/libotutil/ot-gpg-utils.c                       |    2 +-
 src/libotutil/ot-variant-utils.c                   |    4 +-
 src/ostree/ot-admin-builtin-diff.c                 |    6 +-
 src/ostree/ot-admin-builtin-init-fs.c              |    4 +-
 src/ostree/ot-admin-builtin-os-init.c              |    4 +-
 src/ostree/ot-admin-builtin-set-origin.c           |    2 +-
 src/ostree/ot-admin-builtin-switch.c               |    6 +-
 src/ostree/ot-admin-builtin-upgrade.c              |    6 +-
 .../ot-admin-instutil-builtin-grub2-generate.c     |    4 +-
 ...admin-instutil-builtin-selinux-ensure-labeled.c |    8 +-
 src/ostree/ot-builtin-cat.c                        |    8 +-
 src/ostree/ot-builtin-checkout.c                   |   14 ++--
 src/ostree/ot-builtin-checksum.c                   |    2 +-
 src/ostree/ot-builtin-commit.c                     |    8 +-
 src/ostree/ot-builtin-diff.c                       |    6 +-
 src/ostree/ot-builtin-fsck.c                       |    4 +-
 src/ostree/ot-builtin-ls.c                         |   12 ++--
 src/ostree/ot-builtin-pull-local.c                 |    2 +-
 src/ostree/ot-builtin-show.c                       |    6 +-
 src/ostree/ot-builtin-static-delta.c               |    2 +-
 src/ostree/ot-builtin-trivial-httpd.c              |    8 +-
 src/ostree/ot-editor.c                             |    4 +-
 src/ostree/ot-main.c                               |    6 +-
 src/ostree/ot-remote-builtin-add.c                 |    2 +-
 tests/test-bsdiff.c                                |    4 +-
 51 files changed, 320 insertions(+), 320 deletions(-)
---
diff --git a/src/libostree/ostree-bootloader-grub2.c b/src/libostree/ostree-bootloader-grub2.c
index 4e99d46..f237e3d 100644
--- a/src/libostree/ostree-bootloader-grub2.c
+++ b/src/libostree/ostree-bootloader-grub2.c
@@ -54,8 +54,8 @@ _ostree_bootloader_grub2_query (OstreeBootloader *bootloader,
 {
   gboolean ret = FALSE;
   OstreeBootloaderGrub2 *self = OSTREE_BOOTLOADER_GRUB2 (bootloader);
-  gs_unref_object GFile* efi_basedir = NULL;
-  gs_unref_object GFileInfo *file_info = NULL;
+  g_autoptr(GFile) efi_basedir = NULL;
+  g_autoptr(GFileInfo) file_info = NULL;
 
   if (g_file_query_exists (self->config_path_bios, NULL))
     {
@@ -70,7 +70,7 @@ _ostree_bootloader_grub2_query (OstreeBootloader *bootloader,
 
   if (g_file_query_exists (efi_basedir, NULL))
     {
-      gs_unref_object GFileEnumerator *direnum = NULL;
+      g_autoptr(GFileEnumerator) direnum = NULL;
 
       direnum = g_file_enumerate_children (efi_basedir, OSTREE_GIO_FAST_QUERYINFO,
                                            G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
@@ -137,7 +137,7 @@ _ostree_bootloader_grub2_generate_config (OstreeSysroot                 *sysroot
 {
   gboolean ret = FALSE;
   GString *output = g_string_new ("");
-  gs_unref_object GOutputStream *out_stream = NULL;
+  g_autoptr(GOutputStream) out_stream = NULL;
   gs_unref_ptrarray GPtrArray *loader_configs = NULL;
   guint i;
   gsize bytes_written;
@@ -291,14 +291,14 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader      *bootloader,
 {
   OstreeBootloaderGrub2 *self = OSTREE_BOOTLOADER_GRUB2 (bootloader);
   gboolean ret = FALSE;
-  gs_unref_object GFile *efi_new_config_temp = NULL;
-  gs_unref_object GFile *efi_orig_config = NULL;
-  gs_unref_object GFile *new_config_path = NULL;
+  g_autoptr(GFile) efi_new_config_temp = NULL;
+  g_autoptr(GFile) efi_orig_config = NULL;
+  g_autoptr(GFile) new_config_path = NULL;
   gs_unref_object GSSubprocessContext *procctx = NULL;
   gs_unref_object GSSubprocess *proc = NULL;
   gs_strfreev char **child_env = g_get_environ ();
   g_autofree char *bootversion_str = g_strdup_printf ("%u", (guint)bootversion);
-  gs_unref_object GFile *config_path_efi_dir = NULL;
+  g_autoptr(GFile) config_path_efi_dir = NULL;
   g_autofree char *grub2_mkconfig_chroot = NULL;
 
   if (ostree_sysroot_get_booted_deployment (self->sysroot) == NULL
@@ -306,7 +306,7 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader      *bootloader,
     {
       gs_unref_ptrarray GPtrArray *deployments = NULL;
       OstreeDeployment *tool_deployment;
-      gs_unref_object GFile *tool_deployment_root = NULL;
+      g_autoptr(GFile) tool_deployment_root = NULL;
 
       deployments = ostree_sysroot_get_deployments (self->sysroot);
 
@@ -381,7 +381,7 @@ rm -f ${grub_cfg}.new
 
   if (self->is_efi)
     {
-      gs_unref_object GFile *config_path_efi_old = g_file_get_child (config_path_efi_dir, "grub.cfg.old");
+      g_autoptr(GFile) config_path_efi_old = g_file_get_child (config_path_efi_dir, "grub.cfg.old");
       
       /* copy current to old */
       if (!ot_gfile_ensure_unlinked (config_path_efi_old, cancellable, error))
diff --git a/src/libostree/ostree-bootloader-syslinux.c b/src/libostree/ostree-bootloader-syslinux.c
index 71a18ec..0a083f3 100644
--- a/src/libostree/ostree-bootloader-syslinux.c
+++ b/src/libostree/ostree-bootloader-syslinux.c
@@ -122,7 +122,7 @@ _ostree_bootloader_syslinux_write_config (OstreeBootloader          *bootloader,
 {
   gboolean ret = FALSE;
   OstreeBootloaderSyslinux *self = OSTREE_BOOTLOADER_SYSLINUX (bootloader);
-  gs_unref_object GFile *new_config_path = NULL;
+  g_autoptr(GFile) new_config_path = NULL;
   g_autofree char *config_contents = NULL;
   g_autofree char *new_config_contents = NULL;
   gs_unref_ptrarray GPtrArray *new_lines = NULL;
diff --git a/src/libostree/ostree-bootloader-uboot.c b/src/libostree/ostree-bootloader-uboot.c
index a64c66a..7e71ab9 100644
--- a/src/libostree/ostree-bootloader-uboot.c
+++ b/src/libostree/ostree-bootloader-uboot.c
@@ -108,7 +108,7 @@ _ostree_bootloader_uboot_write_config (OstreeBootloader          *bootloader,
                                   GError               **error)
 {
   OstreeBootloaderUboot *self = OSTREE_BOOTLOADER_UBOOT (bootloader);
-  gs_unref_object GFile *new_config_path = NULL;
+  g_autoptr(GFile) new_config_path = NULL;
   g_autofree char *config_contents = NULL;
   g_autofree char *new_config_contents = NULL;
   gs_unref_ptrarray GPtrArray *new_lines = NULL;
diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c
index 84a1809..09d3d58 100644
--- a/src/libostree/ostree-core.c
+++ b/src/libostree/ostree-core.c
@@ -426,11 +426,11 @@ ostree_raw_file_to_content_stream (GInputStream       *input,
   gboolean ret = FALSE;
   gpointer header_data;
   gsize header_size;
-  gs_unref_object GInputStream *ret_input = NULL;
+  g_autoptr(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;
+  g_autoptr(GOutputStream) header_out_stream = NULL;
+  g_autoptr(GInputStream) header_in_stream = NULL;
 
   file_header = file_header_new (file_info, xattrs);
 
@@ -493,8 +493,8 @@ ostree_content_stream_parse (gboolean                compressed,
   guint32 archive_header_size;
   guchar dummy[4];
   gsize bytes_read;
-  gs_unref_object GInputStream *ret_input = NULL;
-  gs_unref_object GFileInfo *ret_file_info = NULL;
+  g_autoptr(GInputStream) ret_input = NULL;
+  g_autoptr(GFileInfo) ret_file_info = NULL;
   gs_unref_variant GVariant *ret_xattrs = NULL;
   gs_unref_variant GVariant *file_header = NULL;
   g_autofree guchar *buf = NULL;
@@ -561,7 +561,7 @@ ostree_content_stream_parse (gboolean                compressed,
        **/
       if (compressed)
         {
-          gs_unref_object GConverter *zlib_decomp = (GConverter*)g_zlib_decompressor_new 
(G_ZLIB_COMPRESSOR_FORMAT_RAW);
+          g_autoptr(GConverter) zlib_decomp = (GConverter*)g_zlib_decompressor_new 
(G_ZLIB_COMPRESSOR_FORMAT_RAW);
           ret_input = g_converter_input_stream_new (input, zlib_decomp);
         }
       else
@@ -604,9 +604,9 @@ ostree_content_file_parse_at (gboolean                compressed,
 {
   gboolean ret = FALSE;
   struct stat stbuf;
-  gs_unref_object GInputStream *file_input = NULL;
-  gs_unref_object GInputStream *ret_input = NULL;
-  gs_unref_object GFileInfo *ret_file_info = NULL;
+  g_autoptr(GInputStream) file_input = NULL;
+  g_autoptr(GInputStream) ret_input = NULL;
+  g_autoptr(GFileInfo) ret_file_info = NULL;
   gs_unref_variant GVariant *ret_xattrs = NULL;
 
   if (!ot_openat_read_stream (parent_dfd, path, TRUE, &file_input,
@@ -744,8 +744,8 @@ ostree_checksum_file (GFile            *f,
                       GError          **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFileInfo *file_info = NULL;
-  gs_unref_object GInputStream *in = NULL;
+  g_autoptr(GFileInfo) file_info = NULL;
+  g_autoptr(GInputStream) in = NULL;
   gs_unref_variant GVariant *xattrs = NULL;
   g_autofree guchar *ret_csum = NULL;
 
@@ -1516,7 +1516,7 @@ file_header_parse (GVariant         *metadata,
   gboolean ret = FALSE;
   guint32 uid, gid, mode, rdev;
   const char *symlink_target;
-  gs_unref_object GFileInfo *ret_file_info = NULL;
+  g_autoptr(GFileInfo) ret_file_info = NULL;
   gs_unref_variant GVariant *ret_xattrs = NULL;
 
   g_variant_get (metadata, "(uuuu&s a(ayay))",
@@ -1577,7 +1577,7 @@ zlib_file_header_parse (GVariant         *metadata,
   guint64 size;
   guint32 uid, gid, mode, rdev;
   const char *symlink_target;
-  gs_unref_object GFileInfo *ret_file_info = NULL;
+  g_autoptr(GFileInfo) ret_file_info = NULL;
   gs_unref_variant GVariant *ret_xattrs = NULL;
 
   g_variant_get (metadata, "(tuuuu&s a(ayay))", &size,
diff --git a/src/libostree/ostree-diff.c b/src/libostree/ostree-diff.c
index 57e78e5..940e693 100644
--- a/src/libostree/ostree-diff.c
+++ b/src/libostree/ostree-diff.c
@@ -45,7 +45,7 @@ get_file_checksum (OstreeDiffFlags  flags,
   else
     {
       gs_unref_variant GVariant *xattrs = NULL;
-      gs_unref_object GInputStream *in = NULL;
+      g_autoptr(GInputStream) in = NULL;
 
       if (!(flags & OSTREE_DIFF_FLAGS_IGNORE_XATTRS))
         {
@@ -160,9 +160,9 @@ diff_add_dir_recurse (GFile          *d,
 {
   gboolean ret = FALSE;
   GError *temp_error = NULL;
-  gs_unref_object GFileEnumerator *dir_enum = NULL;
-  gs_unref_object GFile *child = NULL;
-  gs_unref_object GFileInfo *child_info = NULL;
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
+  g_autoptr(GFile) child = NULL;
+  g_autoptr(GFileInfo) child_info = NULL;
 
   dir_enum = g_file_enumerate_children (d, OSTREE_GIO_FAST_QUERYINFO, 
                                         G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
@@ -225,11 +225,11 @@ ostree_diff_dirs (OstreeDiffFlags flags,
 {
   gboolean ret = FALSE;
   GError *temp_error = 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;
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
+  g_autoptr(GFile) child_a = NULL;
+  g_autoptr(GFile) child_b = NULL;
+  g_autoptr(GFileInfo) child_a_info = NULL;
+  g_autoptr(GFileInfo) child_b_info = NULL;
 
   if (a == NULL)
     {
diff --git a/src/libostree/ostree-fetcher.c b/src/libostree/ostree-fetcher.c
index 9747925..c3072aa 100644
--- a/src/libostree/ostree-fetcher.c
+++ b/src/libostree/ostree-fetcher.c
@@ -258,7 +258,7 @@ _ostree_fetcher_set_client_cert (OstreeFetcher *fetcher,
   if (fetcher->client_cert)
     {
 #ifdef HAVE_LIBSOUP_CLIENT_CERTS
-      gs_unref_object GTlsInteraction *interaction =
+      g_autoptr(GTlsInteraction) interaction =
         (GTlsInteraction*)_ostree_tls_cert_interaction_new (fetcher->client_cert);
       g_object_set (fetcher->session, "tls-interaction", interaction, NULL);
 #else
@@ -419,7 +419,7 @@ on_stream_read (GObject        *object,
        * guaranteed to do a complete write.
        */
       {
-        gs_unref_object GInputStream *membuf =
+        g_autoptr(GInputStream) membuf =
           g_memory_input_stream_new_from_bytes (bytes);
         g_output_stream_splice_async (pending->out_stream, membuf,
                                       G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
@@ -747,7 +747,7 @@ _ostree_fetcher_request_uri_to_membuf (OstreeFetcher  *fetcher,
   gboolean ret = FALSE;
   const guint8 nulchar = 0;
   g_autofree char *ret_contents = NULL;
-  gs_unref_object GMemoryOutputStream *buf = NULL;
+  g_autoptr(GMemoryOutputStream) buf = NULL;
   FetchUriSyncData data;
   g_assert (error != NULL);
 
diff --git a/src/libostree/ostree-gpg-verifier.c b/src/libostree/ostree-gpg-verifier.c
index 42581b3..330362e 100644
--- a/src/libostree/ostree-gpg-verifier.c
+++ b/src/libostree/ostree-gpg-verifier.c
@@ -79,7 +79,7 @@ ostree_gpg_verifier_initable_init (GInitable        *initable,
   gboolean ret = FALSE;
   OstreeGpgVerifier *self = (OstreeGpgVerifier*)initable;
   const char *default_keyring_path = g_getenv ("OSTREE_GPG_HOME");
-  gs_unref_object GFile *default_keyring_dir = NULL;
+  g_autoptr(GFile) default_keyring_dir = NULL;
 
   if (!default_keyring_path)
     default_keyring_path = DATADIR "/ostree/trusted.gpg.d/";
@@ -129,7 +129,7 @@ _ostree_gpg_verifier_check_signature (OstreeGpgVerifier  *self,
   gpgme_data_t data_buffer = NULL;
   gpgme_data_t signature_buffer = NULL;
   g_autofree char *tmp_dir = NULL;
-  glnx_unref_object GOutputStream *target_stream = NULL;
+  g_autoptr(GOutputStream) target_stream = NULL;
   OstreeGpgVerifyResult *result = NULL;
   gboolean success = FALSE;
   GList *link;
@@ -154,7 +154,7 @@ _ostree_gpg_verifier_check_signature (OstreeGpgVerifier  *self,
 
   for (link = self->keyrings; link != NULL; link = link->next)
     {
-      glnx_unref_object GFileInputStream *source_stream = NULL;
+      g_autoptr(GFileInputStream) source_stream = NULL;
       GFile *keyring_file = link->data;
       gssize bytes_written;
       GError *local_error = NULL;
@@ -275,7 +275,7 @@ _ostree_gpg_verifier_add_keyring_dir (OstreeGpgVerifier   *self,
                                       GError             **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFileEnumerator *enumerator = NULL;
+  g_autoptr(GFileEnumerator) enumerator = NULL;
   
   enumerator = g_file_enumerate_children (path, OSTREE_GIO_FAST_QUERYINFO,
                                           G_FILE_QUERY_INFO_NONE,
diff --git a/src/libostree/ostree-kernel-args.c b/src/libostree/ostree-kernel-args.c
index 101ae64..907e8b5 100644
--- a/src/libostree/ostree-kernel-args.c
+++ b/src/libostree/ostree-kernel-args.c
@@ -163,7 +163,7 @@ _ostree_kernel_args_append_proc_cmdline (OstreeKernelArgs *kargs,
                                          GCancellable     *cancellable,
                                          GError          **error)
 {
-  gs_unref_object GFile *proc_cmdline_path = g_file_new_for_path ("/proc/cmdline");
+  g_autoptr(GFile) proc_cmdline_path = g_file_new_for_path ("/proc/cmdline");
   g_autofree char *proc_cmdline = NULL;
   gsize proc_cmdline_len = 0;
   gs_strfreev char **proc_cmdline_args = NULL;
diff --git a/src/libostree/ostree-metalink.c b/src/libostree/ostree-metalink.c
index c2603a4..e88a723 100644
--- a/src/libostree/ostree-metalink.c
+++ b/src/libostree/ostree-metalink.c
@@ -432,7 +432,7 @@ on_fetched_url (GObject              *src,
   GError *local_error = NULL;
   struct stat stbuf;
   int parent_dfd = _ostree_fetcher_get_dfd (self->metalink->fetcher);
-  gs_unref_object GInputStream *instream = NULL;
+  g_autoptr(GInputStream) instream = NULL;
   g_autofree char *result = NULL;
   GChecksum *checksum = NULL;
 
diff --git a/src/libostree/ostree-repo-checkout.c b/src/libostree/ostree-repo-checkout.c
index c46cabb..63a0890 100644
--- a/src/libostree/ostree-repo-checkout.c
+++ b/src/libostree/ostree-repo-checkout.c
@@ -42,7 +42,7 @@ checkout_object_for_uncompressed_cache (OstreeRepo      *self,
 {
   gboolean ret = FALSE;
   g_autofree char *temp_filename = NULL;
-  gs_unref_object GOutputStream *temp_out = NULL;
+  g_autoptr(GOutputStream) temp_out = NULL;
   int fd;
   int res;
   guint32 file_mode;
@@ -218,7 +218,7 @@ checkout_file_from_input_at (OstreeRepo     *self,
     }
   else if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR)
     {
-      gs_unref_object GOutputStream *temp_out = NULL;
+      g_autoptr(GOutputStream) temp_out = NULL;
       int fd;
       guint32 file_mode;
 
@@ -285,7 +285,7 @@ checkout_file_unioning_from_input_at (OstreeRepo     *repo,
     }
   else if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR)
     {
-      gs_unref_object GOutputStream *temp_out = NULL;
+      g_autoptr(GOutputStream) temp_out = NULL;
       guint32 file_mode;
 
       file_mode = g_file_info_get_attribute_uint32 (file_info, "unix::mode");
@@ -390,7 +390,7 @@ checkout_one_file_at (OstreeRepo                        *repo,
   gboolean can_cache;
   gboolean did_hardlink = FALSE;
   char loose_path_buf[_OSTREE_LOOSE_PATH_MAX];
-  gs_unref_object GInputStream *input = NULL;
+  g_autoptr(GInputStream) input = NULL;
   gs_unref_variant GVariant *xattrs = NULL;
 
   is_symlink = g_file_info_get_file_type (source_info) == G_FILE_TYPE_SYMBOLIC_LINK;
@@ -572,7 +572,7 @@ checkout_tree_at (OstreeRepo                        *self,
   int destination_dfd = -1;
   int res;
   gs_unref_variant GVariant *xattrs = NULL;
-  gs_unref_object GFileEnumerator *dir_enum = NULL;
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
 
   /* Create initially with mode 0700, then chown/chmod only when we're
    * done.  This avoids anyone else being able to operate on partially
@@ -794,9 +794,9 @@ ostree_repo_checkout_tree_at (OstreeRepo                         *self,
                               GError                           **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFile* commit_root = NULL;
-  gs_unref_object GFile* target_dir = NULL;
-  gs_unref_object GFileInfo* target_info = NULL;
+  g_autoptr(GFile) commit_root = NULL;
+  g_autoptr(GFile) target_dir = NULL;
+  g_autoptr(GFileInfo) target_info = NULL;
   OstreeRepoCheckoutOptions default_options = { 0, };
 
   if (!options)
@@ -863,8 +863,8 @@ 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))
     {
-      gs_unref_object GFile *objdir = NULL;
-      gs_unref_object GFileEnumerator *enumerator = NULL;
+      g_autoptr(GFile) objdir = NULL;
+      g_autoptr(GFileEnumerator) enumerator = NULL;
       g_autofree char *objdir_name = NULL;
 
       objdir_name = g_strdup_printf ("%02x", GPOINTER_TO_UINT (key));
@@ -891,7 +891,7 @@ ostree_repo_checkout_gc (OstreeRepo        *self,
           nlinks = g_file_info_get_attribute_uint32 (file_info, "unix::nlink");
           if (nlinks == 1)
             {
-              gs_unref_object GFile *objpath = NULL;
+              g_autoptr(GFile) objpath = NULL;
               objpath = g_file_get_child (objdir, g_file_info_get_name (file_info));
               if (!gs_file_unlink (objpath, cancellable, error))
                 goto out;
diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c
index 51d0cac..8d61b0e 100644
--- a/src/libostree/ostree-repo-commit.c
+++ b/src/libostree/ostree-repo-commit.c
@@ -459,7 +459,7 @@ _ostree_repo_open_trusted_content_bare (OstreeRepo          *self,
 {
   gboolean ret = FALSE;
   g_autofree char *temp_filename = NULL;
-  gs_unref_object GOutputStream *ret_stream = NULL;
+  g_autoptr(GOutputStream) ret_stream = NULL;
   gboolean have_obj;
   char loose_objpath[_OSTREE_LOOSE_PATH_MAX];
 
@@ -537,13 +537,13 @@ write_object (OstreeRepo         *self,
   gboolean do_commit;
   OstreeRepoMode repo_mode;
   g_autofree char *temp_filename = NULL;
-  gs_unref_object GFile *stored_path = NULL;
+  g_autoptr(GFile) stored_path = NULL;
   g_autofree guchar *ret_csum = NULL;
   gs_unref_object OstreeChecksumInputStream *checksum_input = NULL;
-  gs_unref_object GInputStream *file_input = NULL;
-  gs_unref_object GFileInfo *file_info = NULL;
+  g_autoptr(GInputStream) file_input = NULL;
+  g_autoptr(GFileInfo) file_info = NULL;
   gs_unref_variant GVariant *xattrs = NULL;
-  gs_unref_object GOutputStream *temp_out = NULL;
+  g_autoptr(GOutputStream) temp_out = NULL;
   gboolean have_obj;
   GChecksum *checksum = NULL;
   gboolean temp_file_is_regular;
@@ -652,8 +652,8 @@ write_object (OstreeRepo         *self,
       else if (repo_mode == OSTREE_REPO_MODE_ARCHIVE_Z2)
         {
           gs_unref_variant GVariant *file_meta = NULL;
-          gs_unref_object GConverter *zlib_compressor = NULL;
-          gs_unref_object GOutputStream *compressed_out_stream = NULL;
+          g_autoptr(GConverter) zlib_compressor = NULL;
+          g_autoptr(GOutputStream) compressed_out_stream = NULL;
 
           if (self->generate_sizes)
             indexable = TRUE;
@@ -1183,7 +1183,7 @@ cleanup_tmpdir (OstreeRepo        *self,
                 GError           **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFileEnumerator *enumerator = NULL;
+  g_autoptr(GFileEnumerator) enumerator = NULL;
   guint64 curtime_secs;
 
   enumerator = g_file_enumerate_children (self->tmp_dir, "standard::name,time::modified",
@@ -1443,7 +1443,7 @@ ostree_repo_write_metadata (OstreeRepo         *self,
                             GError            **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GInputStream *input = NULL;
+  g_autoptr(GInputStream) input = NULL;
   gs_unref_variant GVariant *normalized = NULL;
 
   normalized = g_variant_get_normal_form (object);
@@ -1519,7 +1519,7 @@ ostree_repo_write_metadata_trusted (OstreeRepo         *self,
                                     GCancellable       *cancellable,
                                     GError            **error)
 {
-  gs_unref_object GInputStream *input = NULL;
+  g_autoptr(GInputStream) input = NULL;
   gs_unref_variant GVariant *normalized = NULL;
 
   normalized = g_variant_get_normal_form (variant);
@@ -1921,7 +1921,7 @@ ostree_repo_read_commit_detached_metadata (OstreeRepo      *self,
                                            GError         **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFile *metadata_path =
+  g_autoptr(GFile) metadata_path =
     _ostree_repo_get_commit_metadata_loose_path (self, checksum);
   gs_unref_variant GVariant *ret_metadata = NULL;
   GError *temp_error = NULL;
@@ -1967,7 +1967,7 @@ ostree_repo_write_commit_detached_metadata (OstreeRepo      *self,
                                             GError         **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFile *metadata_path =
+  g_autoptr(GFile) metadata_path =
     _ostree_repo_get_commit_metadata_loose_path (self, checksum);
   gs_unref_variant GVariant *normalized = NULL;
   gsize normalized_size = 0;
@@ -2276,8 +2276,8 @@ write_directory_content_to_mtree_internal (OstreeRepo                  *self,
                                            GError                     **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFile *child = NULL;
-  gs_unref_object GFileInfo *modified_info = NULL;
+  g_autoptr(GFile) child = NULL;
+  g_autoptr(GFileInfo) modified_info = NULL;
   gs_unref_object OstreeMutableTree *child_mtree = NULL;
   g_autofree char *child_relpath = NULL;
   const char *name;
@@ -2356,9 +2356,9 @@ write_directory_content_to_mtree_internal (OstreeRepo                  *self,
     {
       guint64 file_obj_length;
       const char *loose_checksum;
-      gs_unref_object GInputStream *file_input = NULL;
+      g_autoptr(GInputStream) file_input = NULL;
       gs_unref_variant GVariant *xattrs = NULL;
-      gs_unref_object GInputStream *file_object_input = NULL;
+      g_autoptr(GInputStream) file_object_input = NULL;
       g_autofree guchar *child_file_csum = NULL;
       g_autofree char *tmp_checksum = NULL;
 
@@ -2432,8 +2432,8 @@ write_directory_to_mtree_internal (OstreeRepo                  *self,
   gboolean ret = FALSE;
   OstreeRepoCommitFilterResult filter_result;
   OstreeRepoFile *repo_dir = NULL;
-  gs_unref_object GFileEnumerator *dir_enum = NULL;
-  gs_unref_object GFileInfo *child_info = NULL;
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
+  g_autoptr(GFileInfo) child_info = NULL;
 
   if (dir)
     g_debug ("Examining: %s", gs_file_get_path_cached (dir));
@@ -2464,7 +2464,7 @@ write_directory_to_mtree_internal (OstreeRepo                  *self,
     }
   else
     {
-      gs_unref_object GFileInfo *modified_info = NULL;
+      g_autoptr(GFileInfo) modified_info = NULL;
       gs_unref_variant GVariant *xattrs = NULL;
       g_autofree guchar *child_file_csum = NULL;
       g_autofree char *tmp_checksum = NULL;
@@ -2503,7 +2503,7 @@ write_directory_to_mtree_internal (OstreeRepo                  *self,
 
   if (filter_result == OSTREE_REPO_COMMIT_FILTER_ALLOW)
     {
-      gs_unref_object GFileEnumerator *dir_enum = NULL;
+      g_autoptr(GFileEnumerator) dir_enum = NULL;
 
       dir_enum = g_file_enumerate_children ((GFile*)dir, OSTREE_GIO_FAST_QUERYINFO,
                                             G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
@@ -2545,8 +2545,8 @@ write_dfd_iter_to_mtree_internal (OstreeRepo                  *self,
                                   GError                     **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFileInfo *child_info = NULL;
-  gs_unref_object GFileInfo *modified_info = NULL;
+  g_autoptr(GFileInfo) child_info = NULL;
+  g_autoptr(GFileInfo) modified_info = NULL;
   gs_unref_variant GVariant *xattrs = NULL;
   g_autofree guchar *child_file_csum = NULL;
   g_autofree char *tmp_checksum = NULL;
@@ -2601,7 +2601,7 @@ write_dfd_iter_to_mtree_internal (OstreeRepo                  *self,
     {
       struct dirent *dent;
       struct stat stbuf;
-      gs_unref_object GFileInfo *child_info = NULL;
+      g_autoptr(GFileInfo) child_info = NULL;
       const char *loose_checksum;
 
       if (!gs_dirfd_iterator_next_dent (src_dfd_iter, &dent, cancellable, error))
@@ -2739,7 +2739,7 @@ ostree_repo_write_mtree (OstreeRepo           *self,
   GHashTableIter hash_iter;
   gpointer key, value;
   const char *contents_checksum, *metadata_checksum;
-  gs_unref_object GFile *ret_file = NULL;
+  g_autoptr(GFile) ret_file = NULL;
 
   metadata_checksum = ostree_mutable_tree_get_metadata_checksum (mtree);
   if (!metadata_checksum)
@@ -2771,7 +2771,7 @@ ostree_repo_write_mtree (OstreeRepo           *self,
       while (g_hash_table_iter_next (&hash_iter, &key, &value))
         {
           const char *name = key;
-          gs_unref_object GFile *child_file = NULL;
+          g_autoptr(GFile) child_file = NULL;
           OstreeMutableTree *child_dir = value;
 
           if (!ostree_repo_write_mtree (self, child_dir, &child_file,
diff --git a/src/libostree/ostree-repo-file.c b/src/libostree/ostree-repo-file.c
index 47df3fe..84d8a76 100644
--- a/src/libostree/ostree-repo-file.c
+++ b/src/libostree/ostree-repo-file.c
@@ -722,7 +722,7 @@ query_child_info_dir (OstreeRepo               *repo,
                       GError                  **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFileInfo *ret_info = NULL;
+  g_autoptr(GFileInfo) ret_info = NULL;
   gs_unref_variant GVariant *metadata = NULL;
 
   ret_info = g_file_info_new ();
@@ -848,7 +848,7 @@ ostree_repo_file_tree_query_child (OstreeRepoFile  *self,
   gboolean ret = FALSE;
   const char *name = NULL;
   int c;
-  gs_unref_object GFileInfo *ret_info = NULL;
+  g_autoptr(GFileInfo) ret_info = NULL;
   gs_unref_variant GVariant *files_variant = NULL;
   gs_unref_variant GVariant *dirs_variant = NULL;
   gs_unref_variant GVariant *content_csum_v = NULL;
@@ -928,7 +928,7 @@ ostree_repo_file_query_info (GFile                *file,
 {
   gboolean ret = FALSE;
   OstreeRepoFile *self = OSTREE_REPO_FILE (file);
-  gs_unref_object GFileInfo *info = NULL;
+  g_autoptr(GFileInfo) info = NULL;
 
   if (!ostree_repo_file_ensure_resolved (self, error))
     goto out;
@@ -980,7 +980,7 @@ ostree_repo_file_read (GFile         *file,
   gboolean ret = FALSE;
   OstreeRepoFile *self = OSTREE_REPO_FILE (file);
   const char *checksum;
-  gs_unref_object GInputStream *ret_stream = NULL;
+  g_autoptr(GInputStream) ret_stream = NULL;
 
   if (!ostree_repo_file_ensure_resolved (self, error))
     goto out;
diff --git a/src/libostree/ostree-repo-libarchive.c b/src/libostree/ostree-repo-libarchive.c
index d8001e9..389f0f4 100644
--- a/src/libostree/ostree-repo-libarchive.c
+++ b/src/libostree/ostree-repo-libarchive.c
@@ -49,7 +49,7 @@ file_info_from_archive_entry_and_modifier (OstreeRepo *repo,
                                            struct archive_entry *entry,
                                            OstreeRepoCommitModifier *modifier)
 {
-  gs_unref_object GFileInfo *info = NULL;
+  g_autoptr(GFileInfo) info = NULL;
   GFileInfo *modified_info = NULL;
   const struct stat *st;
   guint32 file_type;
@@ -85,8 +85,8 @@ import_libarchive_entry_file (OstreeRepo           *self,
                               GError              **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GInputStream *file_object_input = NULL;
-  gs_unref_object GInputStream *archive_stream = NULL;
+  g_autoptr(GInputStream) file_object_input = NULL;
+  g_autoptr(GInputStream) archive_stream = NULL;
   guint64 length;
   
   if (g_cancellable_set_error_if_cancelled (cancellable, error))
@@ -122,7 +122,7 @@ write_libarchive_entry_to_mtree (OstreeRepo           *self,
   const char *pathname;
   const char *hardlink;
   const char *basename;
-  gs_unref_object GFileInfo *file_info = NULL;
+  g_autoptr(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;
@@ -294,7 +294,7 @@ ostree_repo_write_archive_to_mtree (OstreeRepo                *self,
   struct archive *a = NULL;
   struct archive_entry *entry;
   int r;
-  gs_unref_object GFileInfo *tmp_dir_info = NULL;
+  g_autoptr(GFileInfo) tmp_dir_info = NULL;
   g_autofree guchar *tmp_csum = NULL;
 
   a = archive_read_new ();
diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c
index 74c32db..599ee49 100644
--- a/src/libostree/ostree-repo-pull.c
+++ b/src/libostree/ostree-repo-pull.c
@@ -596,10 +596,10 @@ content_fetch_on_complete (GObject        *object,
   GError **error = &local_error;
   GCancellable *cancellable = NULL;
   guint64 length;
-  gs_unref_object GFileInfo *file_info = NULL;
+  g_autoptr(GFileInfo) file_info = NULL;
   gs_unref_variant GVariant *xattrs = NULL;
-  gs_unref_object GInputStream *file_in = NULL;
-  gs_unref_object GInputStream *object_input = NULL;
+  g_autoptr(GInputStream) file_in = NULL;
+  g_autoptr(GInputStream) object_input = NULL;
   g_autofree char *temp_path = NULL;
   const char *checksum;
   OstreeObjectType objtype;
@@ -855,7 +855,7 @@ static_deltapart_fetch_on_complete (GObject           *object,
   OtPullData *pull_data = fetch_data->pull_data;
   gs_unref_variant GVariant *metadata = NULL;
   g_autofree char *temp_path = NULL;
-  gs_unref_object GInputStream *in = NULL;
+  g_autoptr(GInputStream) in = NULL;
   g_autofree char *actual_checksum = NULL;
   g_autofree guint8 *csum = NULL;
   GError *local_error = NULL;
@@ -1749,7 +1749,7 @@ ostree_repo_pull_with_options (OstreeRepo             *self,
       }
     else if (tls_client_cert_path)
       {
-        gs_unref_object GTlsCertificate *client_cert = NULL;
+        g_autoptr(GTlsCertificate) client_cert = NULL;
 
         g_assert (tls_client_key_path);
 
@@ -1765,7 +1765,7 @@ ostree_repo_pull_with_options (OstreeRepo             *self,
 
   {
     g_autofree char *tls_ca_path = NULL;
-    gs_unref_object GTlsDatabase *db = NULL;
+    g_autoptr(GTlsDatabase) db = NULL;
 
     if (!_ostree_repo_get_remote_option (self,
                                          remote_name_or_baseurl, "tls-ca-path",
@@ -1876,7 +1876,7 @@ ostree_repo_pull_with_options (OstreeRepo             *self,
 
   if (strcmp (soup_uri_get_scheme (pull_data->base_uri), "file") == 0)
     {
-      gs_unref_object GFile *remote_repo_path = g_file_new_for_path (soup_uri_get_path 
(pull_data->base_uri));
+      g_autoptr(GFile) remote_repo_path = g_file_new_for_path (soup_uri_get_path (pull_data->base_uri));
       pull_data->remote_repo_local = ostree_repo_new (remote_repo_path);
       if (!ostree_repo_open (pull_data->remote_repo_local, cancellable, error))
         goto out;
diff --git a/src/libostree/ostree-repo-refs.c b/src/libostree/ostree-repo-refs.c
index 9c6dbe3..723b447 100644
--- a/src/libostree/ostree-repo-refs.c
+++ b/src/libostree/ostree-repo-refs.c
@@ -123,8 +123,8 @@ find_ref_in_remotes (OstreeRepo         *self,
                      GError            **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFileEnumerator *dir_enum = NULL;
-  gs_unref_object GFile *ret_file = NULL;
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
+  g_autoptr(GFile) ret_file = NULL;
 
   dir_enum = g_file_enumerate_children (self->remote_heads_dir, OSTREE_GIO_FAST_QUERYINFO,
                                         G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
@@ -212,7 +212,7 @@ resolve_refspec (OstreeRepo     *self,
   __attribute__((unused)) GCancellable *cancellable = NULL;
   GError *temp_error = NULL;
   g_autofree char *ret_rev = NULL;
-  gs_unref_object GFile *child = NULL;
+  g_autoptr(GFile) child = NULL;
   
   g_return_val_if_fail (ref != NULL, FALSE);
 
@@ -440,7 +440,7 @@ enumerate_refs_recurse (OstreeRepo    *repo,
                         GError       **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFileEnumerator *enumerator = NULL;
+  g_autoptr(GFileEnumerator) enumerator = NULL;
 
   enumerator = g_file_enumerate_children (dir, OSTREE_GIO_FAST_QUERYINFO,
                                           G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
@@ -505,9 +505,9 @@ ostree_repo_list_refs (OstreeRepo       *self,
 
   if (refspec_prefix)
     {
-      gs_unref_object GFile *dir = NULL;
-      gs_unref_object GFile *child = NULL;
-      gs_unref_object GFileInfo *info = NULL;
+      g_autoptr(GFile) dir = NULL;
+      g_autoptr(GFile) child = NULL;
+      g_autoptr(GFileInfo) info = NULL;
 
       if (!ostree_parse_refspec (refspec_prefix, &remote, &ref_prefix, error))
         goto out;
@@ -541,7 +541,7 @@ ostree_repo_list_refs (OstreeRepo       *self,
     }
   else
     {
-      gs_unref_object GFileEnumerator *remote_enumerator = NULL;
+      g_autoptr(GFileEnumerator) remote_enumerator = NULL;
 
       if (!enumerate_refs_recurse (self, NULL, self->local_heads_dir, self->local_heads_dir,
                                    ret_all_refs,
diff --git a/src/libostree/ostree-repo-static-delta-compilation-analysis.c 
b/src/libostree/ostree-repo-static-delta-compilation-analysis.c
index 9f64656..8bcf438 100644
--- a/src/libostree/ostree-repo-static-delta-compilation-analysis.c
+++ b/src/libostree/ostree-repo-static-delta-compilation-analysis.c
@@ -74,7 +74,7 @@ build_content_sizenames_recurse (OstreeRepo                     *repo,
           csizenames = g_hash_table_lookup (sizenames_map, checksum);
           if (!csizenames)
             {
-              gs_unref_object GFileInfo *finfo = NULL;
+              g_autoptr(GFileInfo) finfo = NULL;
 
               csizenames = g_new0 (OstreeDeltaContentSizeNames, 1);
               csizenames->checksum = g_strdup (checksum);
diff --git a/src/libostree/ostree-repo-static-delta-compilation.c 
b/src/libostree/ostree-repo-static-delta-compilation.c
index f89311d..614ae53 100644
--- a/src/libostree/ostree-repo-static-delta-compilation.c
+++ b/src/libostree/ostree-repo-static-delta-compilation.c
@@ -313,8 +313,8 @@ process_one_object (OstreeRepo                       *repo,
 {
   gboolean ret = FALSE;
   guint64 content_size;
-  gs_unref_object GInputStream *content_stream = NULL;
-  gs_unref_object GFileInfo *content_finfo = NULL;
+  g_autoptr(GInputStream) content_stream = NULL;
+  g_autoptr(GFileInfo) content_finfo = NULL;
   gs_unref_variant GVariant *content_xattrs = NULL;
   guint64 compressed_size;
   OstreeStaticDeltaPartBuilder *current_part = *current_part_val;
@@ -456,9 +456,9 @@ get_unpacked_unlinked_content (OstreeRepo       *repo,
   g_autofree char *tmpname = g_strdup ("tmpostree-deltaobj-XXXXXX");
   gs_fd_close int fd = -1;
   gs_unref_bytes GBytes *ret_content = NULL;
-  gs_unref_object GInputStream *istream = NULL;
-  gs_unref_object GFileInfo *ret_finfo = NULL;
-  gs_unref_object GOutputStream *out = NULL;
+  g_autoptr(GInputStream) istream = NULL;
+  g_autoptr(GFileInfo) ret_finfo = NULL;
+  g_autoptr(GOutputStream) out = NULL;
 
   fd = g_mkstemp (tmpname);
   if (fd == -1)
@@ -508,8 +508,8 @@ try_content_bsdiff (OstreeRepo                       *repo,
   gs_unref_hashtable GHashTable *to_bsdiff = NULL;
   gs_unref_bytes GBytes *tmp_from = NULL;
   gs_unref_bytes GBytes *tmp_to = NULL;
-  gs_unref_object GFileInfo *from_finfo = NULL;
-  gs_unref_object GFileInfo *to_finfo = NULL;
+  g_autoptr(GFileInfo) from_finfo = NULL;
+  g_autoptr(GFileInfo) to_finfo = NULL;
   ContentBsdiff *ret_bsdiff = NULL;
 
   *out_bsdiff = NULL;
@@ -550,8 +550,8 @@ try_content_rollsum (OstreeRepo                       *repo,
   gs_unref_hashtable GHashTable *to_rollsum = NULL;
   gs_unref_bytes GBytes *tmp_from = NULL;
   gs_unref_bytes GBytes *tmp_to = NULL;
-  gs_unref_object GFileInfo *from_finfo = NULL;
-  gs_unref_object GFileInfo *to_finfo = NULL;
+  g_autoptr(GFileInfo) from_finfo = NULL;
+  g_autoptr(GFileInfo) to_finfo = NULL;
   OstreeRollsumMatches *matches = NULL;
   ContentRollsum *ret_rollsum = NULL;
 
@@ -656,8 +656,8 @@ process_one_rollsum (OstreeRepo                       *repo,
 {
   gboolean ret = FALSE;
   guint64 content_size;
-  gs_unref_object GInputStream *content_stream = NULL;
-  gs_unref_object GFileInfo *content_finfo = NULL;
+  g_autoptr(GInputStream) content_stream = NULL;
+  g_autoptr(GFileInfo) content_finfo = NULL;
   gs_unref_variant GVariant *content_xattrs = NULL;
   OstreeStaticDeltaPartBuilder *current_part = *current_part_val;
   const guint8 *tmp_to_buf;
@@ -775,8 +775,8 @@ process_one_bsdiff (OstreeRepo                       *repo,
 {
   gboolean ret = FALSE;
   guint64 content_size;
-  gs_unref_object GInputStream *content_stream = NULL;
-  gs_unref_object GFileInfo *content_finfo = NULL;
+  g_autoptr(GInputStream) content_stream = NULL;
+  g_autoptr(GFileInfo) content_finfo = NULL;
   gs_unref_variant GVariant *content_xattrs = NULL;
   OstreeStaticDeltaPartBuilder *current_part = *current_part_val;
   const guint8 *tmp_to_buf;
@@ -828,7 +828,7 @@ process_one_bsdiff (OstreeRepo                       *repo,
       struct bzdiff_opaque_s op;
       const gchar *payload;
       gssize payload_size;
-      gs_unref_object GOutputStream *out = g_memory_output_stream_new_resizable ();
+      g_autoptr(GOutputStream) out = g_memory_output_stream_new_resizable ();
       stream.malloc = malloc;
       stream.free = free;
       stream.write = bzdiff_write;
@@ -871,9 +871,9 @@ generate_delta_lowlatency (OstreeRepo                       *repo,
   GHashTableIter hashiter;
   gpointer key, value;
   OstreeStaticDeltaPartBuilder *current_part = NULL;
-  gs_unref_object GFile *root_from = NULL;
+  g_autoptr(GFile) root_from = NULL;
   gs_unref_variant GVariant *from_commit = NULL;
-  gs_unref_object GFile *root_to = NULL;
+  g_autoptr(GFile) root_to = NULL;
   gs_unref_variant GVariant *to_commit = NULL;
   gs_unref_hashtable GHashTable *to_reachable_objects = NULL;
   gs_unref_hashtable GHashTable *from_reachable_objects = NULL;
@@ -933,7 +933,7 @@ generate_delta_lowlatency (OstreeRepo                       *repo,
         g_hash_table_add (new_reachable_metadata, serialized_key);
       else
         {
-          gs_unref_object GFileInfo *finfo = NULL;
+          g_autoptr(GFileInfo) finfo = NULL;
           GFileType ftype;
 
           if (!ostree_repo_load_file (repo, checksum, NULL, &finfo, NULL,
@@ -1174,7 +1174,7 @@ get_fallback_headers (OstreeRepo               *self,
         }
       else
         {
-          gs_unref_object GFileInfo *file_info = NULL;
+          g_autoptr(GFileInfo) file_info = NULL;
 
           if (!ostree_repo_query_object_storage_size (self, OSTREE_OBJECT_TYPE_FILE,
                                                       checksum,
@@ -1253,8 +1253,8 @@ ostree_repo_static_delta_generate (OstreeRepo                   *self,
   gs_unref_variant GVariant *delta_descriptor = NULL;
   gs_unref_variant GVariant *to_commit = NULL;
   g_autofree char *descriptor_relpath = NULL;
-  gs_unref_object GFile *descriptor_path = NULL;
-  gs_unref_object GFile *descriptor_dir = NULL;
+  g_autoptr(GFile) descriptor_path = NULL;
+  g_autoptr(GFile) descriptor_dir = NULL;
   gs_unref_variant GVariant *tmp_metadata = NULL;
   gs_unref_variant GVariant *fallback_headers = NULL;
 
@@ -1303,13 +1303,13 @@ ostree_repo_static_delta_generate (OstreeRepo                   *self,
       gs_free_checksum GChecksum *checksum = NULL;
       gs_unref_bytes GBytes *objtype_checksum_array = NULL;
       gs_unref_bytes GBytes *checksum_bytes = NULL;
-      gs_unref_object GFile *part_tempfile = NULL;
-      gs_unref_object GOutputStream *part_temp_outstream = NULL;
-      gs_unref_object GInputStream *part_in = NULL;
-      gs_unref_object GInputStream *part_payload_in = NULL;
-      gs_unref_object GMemoryOutputStream *part_payload_out = NULL;
-      gs_unref_object GConverterOutputStream *part_payload_compressor = NULL;
-      gs_unref_object GConverter *compressor = NULL;
+      g_autoptr(GFile) part_tempfile = NULL;
+      g_autoptr(GOutputStream) part_temp_outstream = NULL;
+      g_autoptr(GInputStream) part_in = NULL;
+      g_autoptr(GInputStream) part_payload_in = NULL;
+      g_autoptr(GMemoryOutputStream) part_payload_out = NULL;
+      g_autoptr(GConverterOutputStream) part_payload_compressor = NULL;
+      g_autoptr(GConverter) compressor = NULL;
       gs_unref_variant GVariant *delta_part_content = NULL;
       gs_unref_variant GVariant *delta_part = NULL;
       gs_unref_variant GVariant *delta_part_header = NULL;
@@ -1401,7 +1401,7 @@ ostree_repo_static_delta_generate (OstreeRepo                   *self,
     {
       GFile *tempfile = part_tempfiles->pdata[i];
       g_autofree char *part_relpath = _ostree_get_relative_static_delta_part_path (from, to, i);
-      gs_unref_object GFile *part_path = g_file_resolve_relative_path (self->repodir, part_relpath);
+      g_autoptr(GFile) part_path = g_file_resolve_relative_path (self->repodir, part_relpath);
 
       if (!gs_file_rename (tempfile, part_path, cancellable, error))
         goto out;
diff --git a/src/libostree/ostree-repo-static-delta-core.c b/src/libostree/ostree-repo-static-delta-core.c
index 988b704..264a889 100644
--- a/src/libostree/ostree-repo-static-delta-core.c
+++ b/src/libostree/ostree-repo-static-delta-core.c
@@ -69,7 +69,7 @@ ostree_repo_list_static_delta_names (OstreeRepo                  *self,
 {
   gboolean ret = FALSE;
   gs_unref_ptrarray GPtrArray *ret_deltas = NULL;
-  gs_unref_object GFileEnumerator *dir_enum = NULL;
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
 
   ret_deltas = g_ptr_array_new_with_free_func (g_free);
 
@@ -83,7 +83,7 @@ ostree_repo_list_static_delta_names (OstreeRepo                  *self,
 
       while (TRUE)
         {
-          gs_unref_object GFileEnumerator *dir_enum2 = NULL;
+          g_autoptr(GFileEnumerator) dir_enum2 = NULL;
           GFileInfo *file_info;
           GFile *child;
 
@@ -123,7 +123,7 @@ ostree_repo_list_static_delta_names (OstreeRepo                  *self,
               name2 = gs_file_get_basename_cached (child2);
 
               {
-                gs_unref_object GFile *meta_path = g_file_get_child (child2, "superblock");
+                g_autoptr(GFile) meta_path = g_file_get_child (child2, "superblock");
 
                 if (g_file_query_exists (meta_path, NULL))
                   {
@@ -224,7 +224,7 @@ ostree_repo_static_delta_execute_offline (OstreeRepo                    *self,
 {
   gboolean ret = FALSE;
   guint i, n;
-  gs_unref_object GFile *meta_file = g_file_get_child (dir, "superblock");
+  g_autoptr(GFile) meta_file = g_file_get_child (dir, "superblock");
   gs_unref_variant GVariant *meta = NULL;
   gs_unref_variant GVariant *headers = NULL;
   gs_unref_variant GVariant *fallback = NULL;
@@ -280,9 +280,9 @@ ostree_repo_static_delta_execute_offline (OstreeRepo                    *self,
       gs_unref_variant GVariant *header = NULL;
       gs_unref_variant GVariant *csum_v = NULL;
       gs_unref_variant GVariant *objects = NULL;
-      gs_unref_object GFile *part_path = NULL;
-      gs_unref_object GInputStream *raw_in = NULL;
-      gs_unref_object GInputStream *in = NULL;
+      g_autoptr(GFile) part_path = NULL;
+      g_autoptr(GInputStream) raw_in = NULL;
+      g_autoptr(GInputStream) in = NULL;
 
       header = g_variant_get_child_value (headers, i);
       g_variant_get (header, "(@aytt ay)", &csum_v, &size, &usize, &objects);
diff --git a/src/libostree/ostree-repo-static-delta-processing.c 
b/src/libostree/ostree-repo-static-delta-processing.c
index b82593b..32e6157 100644
--- a/src/libostree/ostree-repo-static-delta-processing.c
+++ b/src/libostree/ostree-repo-static-delta-processing.c
@@ -157,7 +157,7 @@ _ostree_static_delta_part_validate (OstreeRepo     *repo,
                                     GError        **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GInputStream *tmp_in = NULL;
+  g_autoptr(GInputStream) tmp_in = NULL;
   g_autofree guchar *actual_checksum_bytes = NULL;
   g_autofree char *actual_checksum = NULL;
   
@@ -290,9 +290,9 @@ decompress_all (GConverter   *converter,
                 GError      **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GMemoryInputStream *memin = (GMemoryInputStream*)g_memory_input_stream_new_from_bytes 
(data);
-  gs_unref_object GMemoryOutputStream *memout = (GMemoryOutputStream*)g_memory_output_stream_new (NULL, 0, 
g_realloc, g_free);
-  gs_unref_object GInputStream *convin = g_converter_input_stream_new ((GInputStream*)memin, converter);
+  g_autoptr(GMemoryInputStream) memin = (GMemoryInputStream*)g_memory_input_stream_new_from_bytes (data);
+  g_autoptr(GMemoryOutputStream) memout = (GMemoryOutputStream*)g_memory_output_stream_new (NULL, 0, 
g_realloc, g_free);
+  g_autoptr(GInputStream) convin = g_converter_input_stream_new ((GInputStream*)memin, converter);
 
   {
     gssize n_bytes_written = g_output_stream_splice ((GOutputStream*)memout, convin,
@@ -345,7 +345,7 @@ _ostree_static_delta_part_execute (OstreeRepo      *repo,
       break;
     case 'x':
       {
-        gs_unref_object GConverter *decomp =
+        g_autoptr(GConverter) decomp =
           (GConverter*) _ostree_lzma_decompressor_new ();
 
         if (!decompress_all (decomp, part_payload_bytes, &payload_data,
@@ -523,7 +523,7 @@ dispatch_bspatch (OstreeRepo                 *repo,
 {
   gboolean ret = FALSE;
   guint64 offset, length;
-  gs_unref_object GInputStream *in_stream = NULL;
+  g_autoptr(GInputStream) in_stream = NULL;
   g_autoptr(GMappedFile) input_mfile = NULL;
   g_autofree guchar *buf = NULL;
   struct bspatch_stream stream;
@@ -606,8 +606,8 @@ dispatch_open_splice_and_close (OstreeRepo                 *repo,
       guint64 content_offset;
       guint64 objlen;
       gsize bytes_written;
-      gs_unref_object GInputStream *object_input = NULL;
-      gs_unref_object GInputStream *memin = NULL;
+      g_autoptr(GInputStream) object_input = NULL;
+      g_autoptr(GInputStream) memin = NULL;
       
       if (!do_content_open_generic (repo, state, cancellable, error))
         goto out;
@@ -645,7 +645,7 @@ dispatch_open_splice_and_close (OstreeRepo                 *repo,
       else
         {
           /* Slower path, for symlinks and unpacking deltas into archive-z2 */
-          gs_unref_object GFileInfo *finfo = NULL;
+          g_autoptr(GFileInfo) finfo = NULL;
       
           finfo = _ostree_header_gfile_info_new (state->mode, state->uid, state->gid);
 
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 45ebb26..1bf744a 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -565,13 +565,13 @@ ostree_repo_new_default (void)
   if (g_file_test ("objects", G_FILE_TEST_IS_DIR)
       && g_file_test ("config", G_FILE_TEST_IS_REGULAR))
     {
-      gs_unref_object GFile *cwd = g_file_new_for_path (".");
+      g_autoptr(GFile) cwd = g_file_new_for_path (".");
       return ostree_repo_new (cwd);
     }
   else
     {
       const char *envvar = g_getenv ("OSTREE_REPO");
-      gs_unref_object GFile *repo_path = NULL;
+      g_autoptr(GFile) repo_path = NULL;
 
       if (envvar == NULL || *envvar == '\0')
         repo_path = get_default_repo_path ();
@@ -591,7 +591,7 @@ ostree_repo_new_default (void)
 gboolean
 ostree_repo_is_system (OstreeRepo   *repo)
 {
-  gs_unref_object GFile *default_repo_path = get_default_repo_path ();
+  g_autoptr(GFile) default_repo_path = get_default_repo_path ();
   return g_file_equal (repo->repodir, default_repo_path);
 }
 
@@ -775,7 +775,7 @@ impl_repo_remote_add (OstreeRepo     *self,
     {
       const char *sysconf_remotes = SYSCONFDIR "/ostree/remotes.d";
       g_autofree char *basename = g_strconcat (name, ".conf", NULL);
-      gs_unref_object GFile *etc_ostree_remotes_d = NULL;
+      g_autoptr(GFile) etc_ostree_remotes_d = NULL;
 
       if (sysroot == NULL)
         etc_ostree_remotes_d = g_file_new_for_path (sysconf_remotes);
@@ -1175,8 +1175,8 @@ ostree_repo_create (OstreeRepo     *self,
 {
   gboolean ret = FALSE;
   GString *config_data = NULL;
-  gs_unref_object GFile *child = NULL;
-  gs_unref_object GFile *grandchild = NULL;
+  g_autoptr(GFile) child = NULL;
+  g_autoptr(GFile) grandchild = NULL;
   const char *mode_str;
 
   if (!ostree_repo_mode_to_string (mode, &mode_str, error))
@@ -1242,7 +1242,7 @@ enumerate_directory_allow_noent (GFile               *dirpath,
 {
   gboolean ret = FALSE;
   GError *temp_error = NULL;
-  gs_unref_object GFileEnumerator *ret_direnum = NULL;
+  g_autoptr(GFileEnumerator) ret_direnum = NULL;
 
   ret_direnum = g_file_enumerate_children (dirpath, queryargs, queryflags,
                                            cancellable, &temp_error);
@@ -1347,8 +1347,8 @@ append_remotes_d (OstreeRepo          *self,
                   GError             **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFile *etc_ostree_remotes_d = NULL;
-  gs_unref_object GFileEnumerator *direnum = NULL;
+  g_autoptr(GFile) etc_ostree_remotes_d = NULL;
+  g_autoptr(GFileEnumerator) direnum = NULL;
 
   etc_ostree_remotes_d = g_file_new_for_path (SYSCONFDIR "/ostree/remotes.d");
   if (!enumerate_directory_allow_noent (etc_ostree_remotes_d, OSTREE_GIO_FAST_QUERYINFO, 0,
@@ -1492,7 +1492,7 @@ ostree_repo_open (OstreeRepo    *self,
 
   if (parent_repo_path && parent_repo_path[0])
     {
-      gs_unref_object GFile *parent_repo_f = g_file_new_for_path (parent_repo_path);
+      g_autoptr(GFile) parent_repo_f = g_file_new_for_path (parent_repo_path);
 
       self->parent_repo = ostree_repo_new (parent_repo_f);
 
@@ -1787,7 +1787,7 @@ load_metadata_internal (OstreeRepo       *self,
   gboolean ret = FALSE;
   char loose_path_buf[_OSTREE_LOOSE_PATH_MAX];
   int fd = -1;
-  gs_unref_object GInputStream *ret_stream = NULL;
+  g_autoptr(GInputStream) ret_stream = NULL;
   gs_unref_variant GVariant *ret_variant = NULL;
 
   g_return_val_if_fail (OSTREE_OBJECT_TYPE_IS_META (objtype), FALSE);
@@ -1875,7 +1875,7 @@ query_info_for_bare_content_object (OstreeRepo      *self,
   gboolean ret = FALSE;
   struct stat stbuf;
   int res;
-  gs_unref_object GFileInfo *ret_info = NULL;
+  g_autoptr(GFileInfo) ret_info = NULL;
 
   do
     res = fstatat (self->objects_dir_fd, loose_path_buf, &stbuf, AT_SYMLINK_NOFOLLOW);
@@ -1980,8 +1980,8 @@ ostree_repo_load_file (OstreeRepo         *self,
   gboolean ret = FALSE;
   gboolean found = FALSE;
   OstreeRepoMode repo_mode;
-  gs_unref_object GInputStream *ret_input = NULL;
-  gs_unref_object GFileInfo *ret_file_info = NULL;
+  g_autoptr(GInputStream) ret_input = NULL;
+  g_autoptr(GFileInfo) ret_file_info = NULL;
   gs_unref_variant GVariant *ret_xattrs = NULL;
   char loose_path_buf[_OSTREE_LOOSE_PATH_MAX];
 
@@ -1993,7 +1993,7 @@ ostree_repo_load_file (OstreeRepo         *self,
     {
       int fd = -1;
       struct stat stbuf;
-      gs_unref_object GInputStream *tmp_stream = NULL;
+      g_autoptr(GInputStream) tmp_stream = NULL;
 
       if (!openat_allow_noent (self->objects_dir_fd, loose_path_buf, &fd,
                                cancellable, error))
@@ -2068,7 +2068,7 @@ ostree_repo_load_file (OstreeRepo         *self,
                 }
               else if (S_ISLNK (mode))
                 {
-                  gs_unref_object GInputStream *target_input = NULL;
+                  g_autoptr(GInputStream) target_input = NULL;
                   char targetbuf[PATH_MAX+1];
                   gsize target_size;
 
@@ -2174,7 +2174,7 @@ ostree_repo_load_object_stream (OstreeRepo         *self,
 {
   gboolean ret = FALSE;
   guint64 size;
-  gs_unref_object GInputStream *ret_input = NULL;
+  g_autoptr(GInputStream) ret_input = NULL;
 
   if (OSTREE_OBJECT_TYPE_IS_META (objtype))
     {
@@ -2185,8 +2185,8 @@ ostree_repo_load_object_stream (OstreeRepo         *self,
     }
   else
     {
-      gs_unref_object GInputStream *input = NULL;
-      gs_unref_object GFileInfo *finfo = NULL;
+      g_autoptr(GInputStream) input = NULL;
+      g_autoptr(GFileInfo) finfo = NULL;
       gs_unref_variant GVariant *xattrs = NULL;
 
       if (!ostree_repo_load_file (self, checksum, &input, &finfo, &xattrs,
@@ -2308,7 +2308,7 @@ ostree_repo_has_object (OstreeRepo           *self,
 {
   gboolean ret = FALSE;
   gboolean ret_have_object;
-  gs_unref_object GFile *loose_path = NULL;
+  g_autoptr(GFile) loose_path = NULL;
 
   if (!_ostree_repo_find_object (self, objtype, checksum, &loose_path,
                                  cancellable, error))
@@ -2427,7 +2427,7 @@ import_one_object_copy (OstreeRepo    *self,
 {
   gboolean ret = FALSE;
   guint64 length;
-  gs_unref_object GInputStream *object = NULL;
+  g_autoptr(GInputStream) object = NULL;
 
   if (!ostree_repo_load_object_stream (source, objtype, checksum,
                                        &object, &length,
@@ -2827,7 +2827,7 @@ ostree_repo_read_commit (OstreeRepo   *self,
                          GError **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFile *ret_root = NULL;
+  g_autoptr(GFile) ret_root = NULL;
   g_autofree char *resolved_commit = NULL;
 
   if (!ostree_repo_resolve_rev (self, ref, FALSE, &resolved_commit, error))
@@ -3100,8 +3100,8 @@ sign_data (OstreeRepo     *self,
            GError        **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFile *tmp_signature_file = NULL;
-  gs_unref_object GOutputStream *tmp_signature_output = NULL;
+  g_autoptr(GFile) tmp_signature_file = NULL;
+  g_autoptr(GOutputStream) tmp_signature_output = NULL;
   gpgme_ctx_t context = NULL;
   gs_unref_bytes GBytes *ret_signature = NULL;
   gpgme_engine_info_t info;
@@ -3346,9 +3346,9 @@ ostree_repo_sign_delta (OstreeRepo     *self,
   gs_unref_bytes GBytes *signature_data = NULL;
   gs_unref_variant GVariant *commit_variant = NULL;
   g_autofree char *delta_path = NULL;
-  gs_unref_object GFile *delta_file = NULL;
+  g_autoptr(GFile) delta_file = NULL;
   g_autofree char *detached_metadata_relpath = NULL;
-  gs_unref_object GFile *detached_metadata_path = NULL;
+  g_autoptr(GFile) detached_metadata_path = NULL;
   gs_unref_variant GVariant *existing_detached_metadata = NULL;
   gs_unref_variant GVariant *normalized = NULL;
   gs_unref_variant GVariant *new_metadata = NULL;
@@ -3535,7 +3535,7 @@ ostree_repo_verify_commit_ext (OstreeRepo    *self,
 {
   OstreeGpgVerifyResult *result = NULL;
   gs_unref_variant GVariant *commit_variant = NULL;
-  gs_unref_object GFile *keyringdir_ref = NULL;
+  g_autoptr(GFile) keyringdir_ref = NULL;
   gs_unref_variant GVariant *metadata = NULL;
   gs_unref_bytes GBytes *signed_data = NULL;
   g_autofree char *commit_filename = NULL;
diff --git a/src/libostree/ostree-sepolicy.c b/src/libostree/ostree-sepolicy.c
index 71e59e1..c6a797c 100644
--- a/src/libostree/ostree-sepolicy.c
+++ b/src/libostree/ostree-sepolicy.c
@@ -164,11 +164,11 @@ initable_init (GInitable     *initable,
 #ifdef HAVE_SELINUX
   gboolean ret = FALSE;
   OstreeSePolicy *self = OSTREE_SEPOLICY (initable);
-  gs_unref_object GFile *etc_selinux_dir = NULL;
-  gs_unref_object GFile *policy_config_path = NULL;
-  gs_unref_object GFile *policy_root = NULL;
-  gs_unref_object GFileInputStream *filein = NULL;
-  gs_unref_object GDataInputStream *datain = NULL;
+  g_autoptr(GFile) etc_selinux_dir = NULL;
+  g_autoptr(GFile) policy_config_path = NULL;
+  g_autoptr(GFile) policy_root = NULL;
+  g_autoptr(GFileInputStream) filein = NULL;
+  g_autoptr(GDataInputStream) datain = NULL;
   gboolean enabled = FALSE;
   char *policytype = NULL;
   const char *selinux_prefix = "SELINUX=";
@@ -396,7 +396,7 @@ ostree_sepolicy_restorecon (OstreeSePolicy    *self,
 {
 #ifdef HAVE_SELINUX
   gboolean ret = FALSE;
-  gs_unref_object GFileInfo *src_info = NULL;
+  g_autoptr(GFileInfo) src_info = NULL;
   g_autofree char *label = NULL;
   gboolean do_relabel = TRUE;
 
diff --git a/src/libostree/ostree-sysroot-cleanup.c b/src/libostree/ostree-sysroot-cleanup.c
index 02bbe56..46ad0e9 100644
--- a/src/libostree/ostree-sysroot-cleanup.c
+++ b/src/libostree/ostree-sysroot-cleanup.c
@@ -34,8 +34,8 @@ _ostree_sysroot_list_deployment_dirs_for_os (GFile               *osdir,
 {
   gboolean ret = FALSE;
   const char *osname = gs_file_get_basename_cached (osdir);
-  gs_unref_object GFileEnumerator *dir_enum = NULL;
-  gs_unref_object GFile *osdeploy_dir = NULL;
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
+  g_autoptr(GFile) osdeploy_dir = NULL;
   GError *temp_error = NULL;
 
   osdeploy_dir = g_file_get_child (osdir, "deploy");
@@ -97,8 +97,8 @@ list_all_deployment_directories (OstreeSysroot       *self,
                                  GError             **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFileEnumerator *dir_enum = NULL;
-  gs_unref_object GFile *deploydir = NULL;
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
+  g_autoptr(GFile) deploydir = NULL;
   gs_unref_ptrarray GPtrArray *ret_deployments = NULL;
   GError *temp_error = NULL;
 
@@ -184,8 +184,8 @@ list_all_boot_directories (OstreeSysroot       *self,
                            GError             **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFileEnumerator *dir_enum = NULL;
-  gs_unref_object GFile *boot_ostree = NULL;
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
+  g_autoptr(GFile) boot_ostree = NULL;
   gs_unref_ptrarray GPtrArray *ret_bootdirs = NULL;
   GError *temp_error = NULL;
 
@@ -250,7 +250,7 @@ cleanup_other_bootversions (OstreeSysroot       *self,
   gboolean ret = FALSE;
   int cleanup_bootversion;
   int cleanup_subbootversion;
-  gs_unref_object GFile *cleanup_boot_dir = NULL;
+  g_autoptr(GFile) cleanup_boot_dir = NULL;
 
   cleanup_bootversion = self->bootversion == 0 ? 1 : 0;
   cleanup_subbootversion = self->subbootversion == 0 ? 1 : 0;
diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
index eb8f250..7a8af16 100644
--- a/src/libostree/ostree-sysroot-deploy.c
+++ b/src/libostree/ostree-sysroot-deploy.c
@@ -413,7 +413,7 @@ merge_etc_changes (GFile          *orig_etc,
   for (i = 0; i < removed->len; i++)
     {
       GFile *file = removed->pdata[i];
-      gs_unref_object GFile *target_file = NULL;
+      g_autoptr(GFile) target_file = NULL;
       g_autofree char *path = NULL;
 
       path = g_file_get_relative_path (orig_etc, file);
@@ -477,7 +477,7 @@ checkout_deployment_tree (OstreeSysroot     *sysroot,
   const char *csum = ostree_deployment_get_csum (deployment);
   g_autofree char *checkout_target_name = NULL;
   g_autofree char *osdeploy_path = NULL;
-  gs_unref_object GFile *ret_deploy_target_path = NULL;
+  g_autoptr(GFile) ret_deploy_target_path = NULL;
   glnx_fd_close int osdeploy_dfd = -1;
   int ret_fd;
 
@@ -563,7 +563,7 @@ relabel_recursively (OstreeSysroot  *sysroot,
                      GError        **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFileEnumerator *direnum = NULL;
+  g_autoptr(GFileEnumerator) direnum = NULL;
 
   if (!relabel_one_path (sysroot, sepolicy, dir, dir_info, path_parts,
                          cancellable, error))
@@ -621,7 +621,7 @@ selinux_relabel_dir (OstreeSysroot                 *sysroot,
 {
   gboolean ret = FALSE;
   gs_unref_ptrarray GPtrArray *path_parts = g_ptr_array_new ();
-  gs_unref_object GFileInfo *root_info = NULL;
+  g_autoptr(GFileInfo) root_info = NULL;
 
   root_info = g_file_query_info (dir, OSTREE_GIO_FAST_QUERYINFO,
                                  G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
@@ -652,7 +652,7 @@ selinux_relabel_file (OstreeSysroot                 *sysroot,
 {
   gboolean ret = FALSE;
   gs_unref_ptrarray GPtrArray *path_parts = g_ptr_array_new ();
-  gs_unref_object GFileInfo *file_info = g_file_query_info (path, OSTREE_GIO_FAST_QUERYINFO,
+  g_autoptr(GFileInfo) file_info = g_file_query_info (path, OSTREE_GIO_FAST_QUERYINFO,
                                                             G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
                                                             cancellable, error);
   if (!file_info)
@@ -685,9 +685,9 @@ selinux_relabel_var_if_needed (OstreeSysroot                 *sysroot,
    * point in the distant future to only create (and label) /var
    * when doing a deployment.
    */
-  gs_unref_object GFile *deployment_var_labeled = 
+  g_autoptr(GFile) deployment_var_labeled = 
     g_file_get_child (deployment_var_path, ".ostree-selabeled");
-  gs_unref_object GFile *deployment_var_labeled_tmp = 
+  g_autoptr(GFile) deployment_var_labeled_tmp = 
     g_file_get_child (deployment_var_path, ".ostree-selabeled.tmp");
       
   if (!g_file_query_exists (deployment_var_labeled, NULL))
@@ -735,18 +735,18 @@ merge_configuration (OstreeSysroot         *sysroot,
 {
   gboolean ret = FALSE;
   g_autofree char *deployment_abspath = glnx_fdrel_abspath (deployment_dfd, ".");
-  gs_unref_object GFile *deployment_path = g_file_new_for_path (deployment_abspath);
-  gs_unref_object GFile *source_etc_path = NULL;
-  gs_unref_object GFile *source_etc_pristine_path = NULL;
-  gs_unref_object GFile *deployment_usretc_path = NULL;
-  gs_unref_object GFile *deployment_etc_path = NULL;
+  g_autoptr(GFile) deployment_path = g_file_new_for_path (deployment_abspath);
+  g_autoptr(GFile) source_etc_path = NULL;
+  g_autoptr(GFile) source_etc_pristine_path = NULL;
+  g_autoptr(GFile) deployment_usretc_path = NULL;
+  g_autoptr(GFile) deployment_etc_path = NULL;
   gs_unref_object OstreeSePolicy *sepolicy = NULL;
   gboolean etc_exists;
   gboolean usretc_exists;
 
   if (previous_deployment)
     {
-      gs_unref_object GFile *previous_path = NULL;
+      g_autoptr(GFile) previous_path = NULL;
       OstreeBootconfigParser *previous_bootconfig;
 
       previous_path = ostree_sysroot_get_deployment_directory (sysroot, previous_deployment);
@@ -848,9 +848,9 @@ ostree_sysroot_write_origin_file (OstreeSysroot         *sysroot,
 
   if (origin)
     {
-      gs_unref_object GFile *deployment_path = ostree_sysroot_get_deployment_directory (sysroot, deployment);
-      gs_unref_object GFile *origin_path = ostree_sysroot_get_deployment_origin_path (deployment_path);
-      gs_unref_object GFile *origin_parent = g_file_get_parent (origin_path);
+      g_autoptr(GFile) deployment_path = ostree_sysroot_get_deployment_directory (sysroot, deployment);
+      g_autoptr(GFile) origin_path = ostree_sysroot_get_deployment_origin_path (deployment_path);
+      g_autoptr(GFile) origin_parent = g_file_get_parent (origin_path);
       g_autofree char *contents = NULL;
       gsize len;
       gs_unref_bytes GBytes *contents_bytes = NULL;
@@ -881,12 +881,12 @@ get_kernel_from_tree (GFile         *deployroot,
                       GError       **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFile *ostree_bootdir
+  g_autoptr(GFile) ostree_bootdir
     = g_file_resolve_relative_path (deployroot, "usr/lib/ostree-boot");
-  gs_unref_object GFile *bootdir = g_file_get_child (deployroot, "boot");
-  gs_unref_object GFileEnumerator *dir_enum = NULL;
-  gs_unref_object GFile *ret_kernel = NULL;
-  gs_unref_object GFile *ret_initramfs = NULL;
+  g_autoptr(GFile) bootdir = g_file_get_child (deployroot, "boot");
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
+  g_autoptr(GFile) ret_kernel = NULL;
+  g_autoptr(GFile) ret_initramfs = NULL;
   g_autofree char *kernel_checksum = NULL;
   g_autofree char *initramfs_checksum = NULL;
 
@@ -1054,11 +1054,11 @@ swap_bootlinks (OstreeSysroot *self,
   guint i;
   int old_subbootversion;
   int new_subbootversion;
-  gs_unref_object GFile *ostree_dir = g_file_get_child (self->path, "ostree");
+  g_autoptr(GFile) ostree_dir = g_file_get_child (self->path, "ostree");
   g_autofree char *ostree_bootdir_name = g_strdup_printf ("boot.%d", bootversion);
-  gs_unref_object GFile *ostree_bootdir = g_file_resolve_relative_path (ostree_dir, ostree_bootdir_name);
+  g_autoptr(GFile) ostree_bootdir = g_file_resolve_relative_path (ostree_dir, ostree_bootdir_name);
   g_autofree char *ostree_subbootdir_name = NULL;
-  gs_unref_object GFile *ostree_subbootdir = NULL;
+  g_autoptr(GFile) ostree_subbootdir = NULL;
 
   if (bootversion != self->bootversion)
     {
@@ -1091,8 +1091,8 @@ swap_bootlinks (OstreeSysroot *self,
                                                        ostree_deployment_get_osname (deployment),
                                                        ostree_deployment_get_csum (deployment),
                                                        ostree_deployment_get_deployserial (deployment));
-      gs_unref_object GFile *linkname = g_file_get_child (ostree_subbootdir, bootlink_pathname);
-      gs_unref_object GFile *linkname_parent = g_file_get_parent (linkname);
+      g_autoptr(GFile) linkname = g_file_get_child (ostree_subbootdir, bootlink_pathname);
+      g_autoptr(GFile) linkname_parent = g_file_get_parent (linkname);
 
       if (!ot_util_ensure_directory_and_fsync (linkname_parent, cancellable, error))
         goto out;
@@ -1173,16 +1173,16 @@ install_deployment_kernel (OstreeSysroot   *sysroot,
   struct stat stbuf;
   const char *osname = ostree_deployment_get_osname (deployment);
   const char *bootcsum = ostree_deployment_get_bootcsum (deployment);
-  gs_unref_object GFile *bootdir = NULL;
-  gs_unref_object GFile *bootcsumdir = NULL;
-  gs_unref_object GFile *bootconfpath = NULL;
-  gs_unref_object GFile *bootconfpath_parent = NULL;
+  g_autoptr(GFile) bootdir = NULL;
+  g_autoptr(GFile) bootcsumdir = NULL;
+  g_autoptr(GFile) bootconfpath = NULL;
+  g_autoptr(GFile) bootconfpath_parent = NULL;
   g_autofree char *dest_kernel_name = NULL;
-  gs_unref_object GFile *dest_kernel_path = NULL;
-  gs_unref_object GFile *dest_initramfs_path = NULL;
-  gs_unref_object GFile *tree_kernel_path = NULL;
-  gs_unref_object GFile *tree_initramfs_path = NULL;
-  gs_unref_object GFile *deployment_dir = NULL;
+  g_autoptr(GFile) dest_kernel_path = NULL;
+  g_autoptr(GFile) dest_initramfs_path = NULL;
+  g_autoptr(GFile) tree_kernel_path = NULL;
+  g_autoptr(GFile) tree_initramfs_path = NULL;
+  g_autoptr(GFile) deployment_dir = NULL;
   glnx_fd_close int deployment_dfd = -1;
   g_autofree char *contents = NULL;
   g_autofree char *deployment_version = NULL;
@@ -1380,7 +1380,7 @@ swap_bootloader (OstreeSysroot  *sysroot,
                  GError        **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFile *boot_loader_link = NULL;
+  g_autoptr(GFile) boot_loader_link = NULL;
   g_autofree char *new_target = NULL;
 
   g_assert ((current_bootversion == 0 && new_bootversion == 1) ||
@@ -1475,8 +1475,8 @@ cleanup_legacy_current_symlinks (OstreeSysroot         *self,
     {
       OstreeDeployment *deployment = self->deployments->pdata[i];
       const char *osname = ostree_deployment_get_osname (deployment);
-      gs_unref_object GFile *osdir = ot_gfile_resolve_path_printf (self->path, "ostree/deploy/%s", osname);
-      gs_unref_object GFile *legacy_link = g_file_get_child (osdir, "current");
+      g_autoptr(GFile) osdir = ot_gfile_resolve_path_printf (self->path, "ostree/deploy/%s", osname);
+      g_autoptr(GFile) legacy_link = g_file_get_child (osdir, "current");
 
       if (!ot_gfile_ensure_unlinked (legacy_link, cancellable, error))
         goto out;
@@ -1538,7 +1538,7 @@ ostree_sysroot_write_deployments (OstreeSysroot     *self,
   for (i = 0; i < new_deployments->len; i++)
     {
       OstreeDeployment *deployment = new_deployments->pdata[i];
-      gs_unref_object GFile *deployment_root = NULL;
+      g_autoptr(GFile) deployment_root = NULL;
       
       if (deployment == self->booted_deployment)
         found_booted_deployment = TRUE;
@@ -1583,7 +1583,7 @@ ostree_sysroot_write_deployments (OstreeSysroot     *self,
     {
       int new_bootversion = self->bootversion ? 0 : 1;
       gs_unref_object OstreeBootloader *bootloader = NULL;
-      gs_unref_object GFile *new_loader_entries_dir = NULL;
+      g_autoptr(GFile) new_loader_entries_dir = NULL;
       gs_unref_object OstreeRepo *repo = NULL;
       gboolean show_osname = FALSE;
 
@@ -1709,7 +1709,7 @@ allocate_deployserial (OstreeSysroot           *self,
   gboolean ret = FALSE;
   guint i;
   int new_deployserial = 0;
-  gs_unref_object GFile *osdir = NULL;
+  g_autoptr(GFile) osdir = NULL;
   gs_unref_ptrarray GPtrArray *tmp_current_deployments =
     g_ptr_array_new_with_free_func (g_object_unref);
 
@@ -1768,11 +1768,11 @@ ostree_sysroot_deploy_tree (OstreeSysroot     *self,
   gs_unref_object OstreeDeployment *new_deployment = NULL;
   gs_unref_object OstreeDeployment *merge_deployment = NULL;
   gs_unref_object OstreeRepo *repo = NULL;
-  gs_unref_object GFile *osdeploydir = NULL;
-  gs_unref_object GFile *deployment_var = NULL;
-  gs_unref_object GFile *commit_root = NULL;
-  gs_unref_object GFile *tree_kernel_path = NULL;
-  gs_unref_object GFile *tree_initramfs_path = NULL;
+  g_autoptr(GFile) osdeploydir = NULL;
+  g_autoptr(GFile) deployment_var = NULL;
+  g_autoptr(GFile) commit_root = NULL;
+  g_autoptr(GFile) tree_kernel_path = NULL;
+  g_autoptr(GFile) tree_initramfs_path = NULL;
   glnx_fd_close int deployment_dfd = -1;
   gs_unref_object OstreeSePolicy *sepolicy = NULL;
   g_autofree char *new_bootcsum = NULL;
diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c
index 1e1c037..e6bc632 100644
--- a/src/libostree/ostree-sysroot.c
+++ b/src/libostree/ostree-sysroot.c
@@ -121,7 +121,7 @@ static void
 ostree_sysroot_constructed (GObject *object)
 {
   OstreeSysroot *self = OSTREE_SYSROOT (object);
-  gs_unref_object GFile *repo_path = NULL;
+  g_autoptr(GFile) repo_path = NULL;
 
   g_assert (self->path != NULL);
 
@@ -177,7 +177,7 @@ ostree_sysroot_new (GFile *path)
 OstreeSysroot*
 ostree_sysroot_new_default (void)
 {
-  gs_unref_object GFile *rootfs = g_file_new_for_path ("/");
+  g_autoptr(GFile) rootfs = g_file_new_for_path ("/");
   return ostree_sysroot_new (rootfs);
 }
 
@@ -238,9 +238,9 @@ ostree_sysroot_ensure_initialized (OstreeSysroot  *self,
                                    GError        **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFile *dir = NULL;
-  gs_unref_object GFile *ostree_dir = NULL;
-  gs_unref_object GFile *repo_dir = NULL;
+  g_autoptr(GFile) dir = NULL;
+  g_autoptr(GFile) ostree_dir = NULL;
+  g_autoptr(GFile) repo_dir = NULL;
 
   ostree_dir = g_file_get_child (self->path, "ostree");
   repo_dir = g_file_get_child (ostree_dir, "repo");
@@ -885,7 +885,7 @@ ostree_sysroot_get_deployment_directory (OstreeSysroot    *self,
 GFile *
 ostree_sysroot_get_deployment_origin_path (GFile   *deployment_path)
 {
-  gs_unref_object GFile *deployment_parent = g_file_get_parent (deployment_path);
+  g_autoptr(GFile) deployment_parent = g_file_get_parent (deployment_path);
   return ot_gfile_resolve_path_printf (deployment_parent,
                                        "%s.origin",
                                        gs_file_get_path_cached (deployment_path));
@@ -995,7 +995,7 @@ parse_kernel_commandline (OstreeKernelArgs  **out_args,
                           GError            **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFile *proc_cmdline = g_file_new_for_path ("/proc/cmdline");
+  g_autoptr(GFile) proc_cmdline = g_file_new_for_path ("/proc/cmdline");
   g_autofree char *contents = NULL;
   gsize len;
 
diff --git a/src/libotutil/ot-checksum-utils.c b/src/libotutil/ot-checksum-utils.c
index 525b148..b2aaf32 100644
--- a/src/libotutil/ot-checksum-utils.c
+++ b/src/libotutil/ot-checksum-utils.c
@@ -147,7 +147,7 @@ ot_checksum_file (GFile          *file,
 {
   GChecksum *checksum = NULL;
   char *ret = NULL;
-  gs_unref_object GInputStream *in = NULL;
+  g_autoptr(GInputStream) in = NULL;
 
   in = (GInputStream*)g_file_read (file, cancellable, error);
   if (!in)
diff --git a/src/libotutil/ot-gio-utils.c b/src/libotutil/ot-gio-utils.c
index bb8675a..2693eec 100644
--- a/src/libotutil/ot-gio-utils.c
+++ b/src/libotutil/ot-gio-utils.c
@@ -161,8 +161,8 @@ ot_gfile_get_symlink_target_from_info (GFile             *path,
 {
   gboolean ret = FALSE;
   const char *target;
-  gs_unref_object GFile *path_parent = NULL;
-  gs_unref_object GFile *ret_target = NULL;
+  g_autoptr(GFile) path_parent = NULL;
+  g_autoptr(GFile) ret_target = NULL;
 
   if (g_file_info_get_file_type (file_info) != G_FILE_TYPE_SYMBOLIC_LINK)
     {
@@ -191,7 +191,7 @@ ot_gfile_query_info_allow_noent (GFile                *path,
                                  GError              **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFileInfo *ret_file_info = NULL;
+  g_autoptr(GFileInfo) ret_file_info = NULL;
   GError *temp_error = NULL;
 
   ret_file_info = g_file_query_info (path, queryopts, flags,
@@ -222,8 +222,8 @@ ot_gfile_query_symlink_target_allow_noent (GFile          *path,
                                            GError        **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFileInfo *file_info = NULL;
-  gs_unref_object GFile *ret_target = NULL;
+  g_autoptr(GFileInfo) file_info = NULL;
+  g_autoptr(GFile) ret_target = NULL;
 
   if (!ot_gfile_query_info_allow_noent (path, OSTREE_GIO_FAST_QUERYINFO,
                                         G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
@@ -291,8 +291,8 @@ ot_file_replace_contents_at (int             dfd,
   gboolean ret = FALSE;
   int fd;
   g_autofree char *tmpname = NULL;
-  gs_unref_object GOutputStream *stream = NULL;
-  gs_unref_object GInputStream *instream = NULL;
+  g_autoptr(GOutputStream) stream = NULL;
+  g_autoptr(GInputStream) instream = NULL;
 
   if (!gs_file_open_in_tmpdir_at (dfd, 0644,
                                   &tmpname, &stream,
@@ -356,7 +356,7 @@ ot_gfile_replace_contents_fsync (GFile          *path,
   gboolean ret = FALSE;
   int parent_dfd;
   const char *target_basename = gs_file_get_basename_cached (path);
-  gs_unref_object GFile *parent = NULL;
+  g_autoptr(GFile) parent = NULL;
 
   parent = g_file_get_parent (path);
 
@@ -457,7 +457,7 @@ ot_util_ensure_directory_and_fsync (GFile         *dir,
   gboolean ret = FALSE;
   int parentfd = -1;
   const char *basename = gs_file_get_basename_cached (dir);
-  gs_unref_object GFile *parent = g_file_get_parent (dir);
+  g_autoptr(GFile) parent = g_file_get_parent (dir);
   
  again:
   parentfd = open (gs_file_get_path_cached (parent),
@@ -528,9 +528,9 @@ ot_gfile_atomic_symlink_swap (GFile          *path,
                               GError        **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFile *parent = g_file_get_parent (path);
+  g_autoptr(GFile) parent = g_file_get_parent (path);
   g_autofree char *tmpname = g_strconcat (gs_file_get_basename_cached (path), ".tmp", NULL);
-  gs_unref_object GFile *tmppath = g_file_get_child (parent, tmpname);
+  g_autoptr(GFile) tmppath = g_file_get_child (parent, tmpname);
   int parent_dfd = -1;
 
   if (!ot_gfile_ensure_unlinked (tmppath, cancellable, error))
diff --git a/src/libotutil/ot-gpg-utils.c b/src/libotutil/ot-gpg-utils.c
index 959f0f4..88b436f 100644
--- a/src/libotutil/ot-gpg-utils.c
+++ b/src/libotutil/ot-gpg-utils.c
@@ -108,7 +108,7 @@ ot_gpgme_ctx_tmp_home_dir (gpgme_ctx_t     gpgme_ctx,
   if (out_pubring_stream != NULL)
     {
       GFileOutputStream *pubring_stream;
-      glnx_unref_object GFile *pubring_file = NULL;
+      g_autoptr(GFile) pubring_file = NULL;
       g_autofree char *pubring_path = NULL;
 
       pubring_path = g_build_filename (tmp_home_dir, "pubring.gpg", NULL);
diff --git a/src/libotutil/ot-variant-utils.c b/src/libotutil/ot-variant-utils.c
index 28fd49b..52d95f3 100644
--- a/src/libotutil/ot-variant-utils.c
+++ b/src/libotutil/ot-variant-utils.c
@@ -85,7 +85,7 @@ ot_util_variant_save (GFile *dest,
                       GError  **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GOutputStream *out = NULL;
+  g_autoptr(GOutputStream) out = NULL;
   gsize bytes_written;
   
   out = (GOutputStream*)g_file_replace (dest, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION,
@@ -220,7 +220,7 @@ ot_util_variant_from_stream (GInputStream         *src,
                              GError              **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GMemoryOutputStream *data_stream = NULL;
+  g_autoptr(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/ostree/ot-admin-builtin-diff.c b/src/ostree/ot-admin-builtin-diff.c
index ede1f6e..60bfcd3 100644
--- a/src/ostree/ot-admin-builtin-diff.c
+++ b/src/ostree/ot-admin-builtin-diff.c
@@ -44,12 +44,12 @@ ot_admin_builtin_diff (int argc, char **argv, GCancellable *cancellable, GError
   gs_unref_object OstreeSysroot *sysroot = NULL;
   gboolean ret = FALSE;
   gs_unref_object OstreeDeployment *deployment = NULL;
-  gs_unref_object GFile *deployment_dir = NULL;
+  g_autoptr(GFile) deployment_dir = NULL;
   gs_unref_ptrarray GPtrArray *modified = NULL;
   gs_unref_ptrarray GPtrArray *removed = NULL;
   gs_unref_ptrarray GPtrArray *added = NULL;
-  gs_unref_object GFile *orig_etc_path = NULL;
-  gs_unref_object GFile *new_etc_path = NULL;
+  g_autoptr(GFile) orig_etc_path = NULL;
+  g_autoptr(GFile) new_etc_path = NULL;
 
   context = g_option_context_new ("Diff current /etc configuration versus default");
 
diff --git a/src/ostree/ot-admin-builtin-init-fs.c b/src/ostree/ot-admin-builtin-init-fs.c
index d24becc..943a68f 100644
--- a/src/ostree/ot-admin-builtin-init-fs.c
+++ b/src/ostree/ot-admin-builtin-init-fs.c
@@ -40,8 +40,8 @@ ot_admin_builtin_init_fs (int argc, char **argv, GCancellable *cancellable, GErr
   GOptionContext *context;
   gs_unref_object OstreeSysroot *sysroot = NULL;
   gboolean ret = FALSE;
-  gs_unref_object GFile *dir = NULL;
-  gs_unref_object GFile *child = NULL;
+  g_autoptr(GFile) dir = NULL;
+  g_autoptr(GFile) child = NULL;
   gs_unref_object OstreeSysroot *target_sysroot = NULL;
   guint i;
   const char *normal_toplevels[] = {"boot", "dev", "home", "proc", "run", "sys"};
diff --git a/src/ostree/ot-admin-builtin-os-init.c b/src/ostree/ot-admin-builtin-os-init.c
index b4e317c..ee5c9dc 100644
--- a/src/ostree/ot-admin-builtin-os-init.c
+++ b/src/ostree/ot-admin-builtin-os-init.c
@@ -41,8 +41,8 @@ ot_admin_builtin_os_init (int argc, char **argv, GCancellable *cancellable, GErr
   gs_unref_object OstreeSysroot *sysroot = NULL;
   gboolean ret = FALSE;
   const char *osname = NULL;
-  gs_unref_object GFile *deploy_dir = NULL;
-  gs_unref_object GFile *dir = NULL;
+  g_autoptr(GFile) deploy_dir = NULL;
+  g_autoptr(GFile) dir = NULL;
 
   context = g_option_context_new ("OSNAME - Initialize empty state for given operating system");
 
diff --git a/src/ostree/ot-admin-builtin-set-origin.c b/src/ostree/ot-admin-builtin-set-origin.c
index bcf1b38..a3f071c 100644
--- a/src/ostree/ot-admin-builtin-set-origin.c
+++ b/src/ostree/ot-admin-builtin-set-origin.c
@@ -130,7 +130,7 @@ ot_admin_builtin_set_origin (int argc, char **argv, GCancellable *cancellable, G
 
     { g_autofree char *new_refspec = g_strconcat (remotename, ":", branch ? branch : origin_ref, NULL);
       gs_unref_keyfile GKeyFile *new_origin = NULL;
-      gs_unref_object GFile *origin_path = NULL;
+      g_autoptr(GFile) origin_path = NULL;
       
       new_origin = ostree_sysroot_origin_new_from_refspec (sysroot, new_refspec);
 
diff --git a/src/ostree/ot-admin-builtin-switch.c b/src/ostree/ot-admin-builtin-switch.c
index 9a0a5ce..db3d0c3 100644
--- a/src/ostree/ot-admin-builtin-switch.c
+++ b/src/ostree/ot-admin-builtin-switch.c
@@ -54,8 +54,8 @@ ot_admin_builtin_switch (int argc, char **argv, GCancellable *cancellable, GErro
   g_autofree char *new_ref = NULL;
   g_autofree char *new_refspec = NULL;
   g_autofree char *new_revision = NULL;
-  gs_unref_object GFile *deployment_path = NULL;
-  gs_unref_object GFile *deployment_origin_path = NULL;
+  g_autoptr(GFile) deployment_path = NULL;
+  g_autoptr(GFile) deployment_origin_path = NULL;
   gs_unref_object OstreeDeployment *merge_deployment = NULL;
   gs_unref_object OstreeDeployment *new_deployment = NULL;
   gs_unref_object OstreeSysrootUpgrader *upgrader = NULL;
@@ -164,7 +164,7 @@ ot_admin_builtin_switch (int argc, char **argv, GCancellable *cancellable, GErro
     goto out;
   
   {
-    gs_unref_object GFile *real_sysroot = g_file_new_for_path ("/");
+    g_autoptr(GFile) real_sysroot = g_file_new_for_path ("/");
       
     if (opt_reboot && g_file_equal (ostree_sysroot_get_path (sysroot), real_sysroot))
       {
diff --git a/src/ostree/ot-admin-builtin-upgrade.c b/src/ostree/ot-admin-builtin-upgrade.c
index d244aee..875f6fe 100644
--- a/src/ostree/ot-admin-builtin-upgrade.c
+++ b/src/ostree/ot-admin-builtin-upgrade.c
@@ -55,8 +55,8 @@ ot_admin_builtin_upgrade (int argc, char **argv, GCancellable *cancellable, GErr
   g_autofree char *origin_ref = NULL;
   g_autofree char *origin_refspec = NULL;
   g_autofree char *new_revision = NULL;
-  gs_unref_object GFile *deployment_path = NULL;
-  gs_unref_object GFile *deployment_origin_path = NULL;
+  g_autoptr(GFile) deployment_path = NULL;
+  g_autoptr(GFile) deployment_origin_path = NULL;
   gs_unref_object OstreeDeployment *merge_deployment = NULL;
   gs_unref_object OstreeDeployment *new_deployment = NULL;
   GSConsole *console = NULL;
@@ -108,7 +108,7 @@ ot_admin_builtin_upgrade (int argc, char **argv, GCancellable *cancellable, GErr
     }
   else
     {
-      gs_unref_object GFile *real_sysroot = g_file_new_for_path ("/");
+      g_autoptr(GFile) real_sysroot = g_file_new_for_path ("/");
 
       if (!ostree_sysroot_upgrader_deploy (upgrader, cancellable, error))
         goto out;
diff --git a/src/ostree/ot-admin-instutil-builtin-grub2-generate.c 
b/src/ostree/ot-admin-instutil-builtin-grub2-generate.c
index 1903a44..7fd05b6 100644
--- a/src/ostree/ot-admin-instutil-builtin-grub2-generate.c
+++ b/src/ostree/ot-admin-instutil-builtin-grub2-generate.c
@@ -38,12 +38,12 @@ ot_admin_instutil_builtin_grub2_generate (int argc, char **argv, GCancellable *c
 {
   gboolean ret = FALSE;
   guint bootversion;
-  gs_unref_object GFile *subpath = NULL;
+  g_autoptr(GFile) subpath = NULL;
   gs_unref_object OstreeSePolicy *sepolicy = NULL;
   gs_unref_ptrarray GPtrArray *deployments = NULL;
   GOptionContext *context = NULL;
   gs_unref_object OstreeSysroot *sysroot = NULL;
-  gs_unref_object GFile *deployment_path = NULL;
+  g_autoptr(GFile) deployment_path = NULL;
 
   context = g_option_context_new ("[BOOTVERSION] - generate GRUB2 configuration from given BLS entries");
 
diff --git a/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c 
b/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c
index 38cbc06..d1e80e9 100644
--- a/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c
+++ b/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c
@@ -96,7 +96,7 @@ relabel_recursively (OstreeSePolicy *sepolicy,
                      GError        **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFileEnumerator *direnum = NULL;
+  g_autoptr(GFileEnumerator) direnum = NULL;
 
   if (!relabel_one_path (sepolicy, dir, dir_info, path_parts,
                          cancellable, error))
@@ -153,7 +153,7 @@ selinux_relabel_dir (OstreeSePolicy                *sepolicy,
 {
   gboolean ret = FALSE;
   gs_unref_ptrarray GPtrArray *path_parts = g_ptr_array_new ();
-  gs_unref_object GFileInfo *root_info = NULL;
+  g_autoptr(GFileInfo) root_info = NULL;
 
   root_info = g_file_query_info (dir, OSTREE_GIO_FAST_QUERYINFO,
                                  G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
@@ -183,14 +183,14 @@ ot_admin_instutil_builtin_selinux_ensure_labeled (int argc, char **argv, GCancel
 {
   gboolean ret = FALSE;
   const char *policy_name;
-  gs_unref_object GFile *subpath = NULL;
+  g_autoptr(GFile) subpath = NULL;
   const char *prefix = NULL;
   gs_unref_object OstreeSePolicy *sepolicy = NULL;
   gs_unref_ptrarray GPtrArray *deployments = NULL;
   OstreeDeployment *first_deployment;
   GOptionContext *context = NULL;
   gs_unref_object OstreeSysroot *sysroot = NULL;
-  gs_unref_object GFile *deployment_path = NULL;
+  g_autoptr(GFile) deployment_path = NULL;
 
   context = g_option_context_new ("[SUBPATH PREFIX] - relabel all or part of a deployment");
 
diff --git a/src/ostree/ot-builtin-cat.c b/src/ostree/ot-builtin-cat.c
index 8eff545..f63ec5d 100644
--- a/src/ostree/ot-builtin-cat.c
+++ b/src/ostree/ot-builtin-cat.c
@@ -40,7 +40,7 @@ cat_one_file (GFile         *f,
               GError       **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GInputStream *in = NULL;
+  g_autoptr(GInputStream) in = NULL;
   
   in = (GInputStream*)g_file_read (f, cancellable, error);
   if (!in)
@@ -66,9 +66,9 @@ ostree_builtin_cat (int argc, char **argv, GCancellable *cancellable, GError **e
   gboolean ret = FALSE;
   int i;
   const char *rev;
-  gs_unref_object GOutputStream *stdout_stream = NULL;
-  gs_unref_object GFile *root = NULL;
-  gs_unref_object GFile *f = NULL;
+  g_autoptr(GOutputStream) stdout_stream = NULL;
+  g_autoptr(GFile) root = NULL;
+  g_autoptr(GFile) f = NULL;
 
   context = g_option_context_new ("COMMIT PATH... - Concatenate contents of files");
 
diff --git a/src/ostree/ot-builtin-checkout.c b/src/ostree/ot-builtin-checkout.c
index 0b9a0aa..a1ce316 100644
--- a/src/ostree/ot-builtin-checkout.c
+++ b/src/ostree/ot-builtin-checkout.c
@@ -104,10 +104,10 @@ process_one_checkout (OstreeRepo           *repo,
   else
     {
       GError *tmp_error = NULL;
-      gs_unref_object GFile *root = NULL;
-      gs_unref_object GFile *subtree = NULL;
-      gs_unref_object GFileInfo *file_info = NULL;
-      gs_unref_object GFile *destination_file = g_file_new_for_path (destination);
+      g_autoptr(GFile) root = NULL;
+      g_autoptr(GFile) subtree = NULL;
+      g_autoptr(GFileInfo) file_info = NULL;
+      g_autoptr(GFile) destination_file = g_file_new_for_path (destination);
 
       if (!ostree_repo_read_commit (repo, resolved_commit, &root, NULL, cancellable, error))
         goto out;
@@ -157,8 +157,8 @@ process_many_checkouts (OstreeRepo         *repo,
   gboolean ret = FALSE;
   gsize len;
   GError *temp_error = NULL;
-  gs_unref_object GInputStream *instream = NULL;
-  gs_unref_object GDataInputStream *datastream = NULL;
+  g_autoptr(GInputStream) instream = NULL;
+  g_autoptr(GDataInputStream) datastream = NULL;
   g_autofree char *revision = NULL;
   g_autofree char *subpath = NULL;
   g_autofree char *resolved_commit = NULL;
@@ -169,7 +169,7 @@ process_many_checkouts (OstreeRepo         *repo,
     }
   else
     {
-      gs_unref_object GFile *f = g_file_new_for_path (opt_from_file);
+      g_autoptr(GFile) f = g_file_new_for_path (opt_from_file);
 
       instream = (GInputStream*)g_file_read (f, cancellable, error);
       if (!instream)
diff --git a/src/ostree/ot-builtin-checksum.c b/src/ostree/ot-builtin-checksum.c
index 9381bf7..3a57025 100644
--- a/src/ostree/ot-builtin-checksum.c
+++ b/src/ostree/ot-builtin-checksum.c
@@ -61,7 +61,7 @@ ostree_builtin_checksum (int argc, char **argv, GCancellable *cancellable, GErro
 {
   GOptionContext *context;
   gboolean ret = FALSE;
-  gs_unref_object GFile *f = NULL;
+  g_autoptr(GFile) f = NULL;
   AsyncChecksumData data = { 0, };
 
   context = g_option_context_new ("PATH - Checksum a file or directory");
diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c
index 61ac592..73885bc 100644
--- a/src/ostree/ot-builtin-commit.c
+++ b/src/ostree/ot-builtin-commit.c
@@ -96,7 +96,7 @@ parse_statoverride_file (GHashTable   **out_mode_add,
   gsize len;
   char **iter = NULL; /* nofree */
   gs_unref_hashtable GHashTable *ret_hash = NULL;
-  gs_unref_object GFile *path = NULL;
+  g_autoptr(GFile) path = NULL;
   g_autofree char *contents = NULL;
   char **lines = NULL;
 
@@ -295,10 +295,10 @@ ostree_builtin_commit (int argc, char **argv, GCancellable *cancellable, GError
   gs_unref_object OstreeRepo *repo = NULL;
   gboolean ret = FALSE;
   gboolean skip_commit = FALSE;
-  gs_unref_object GFile *arg = NULL;
+  g_autoptr(GFile) arg = NULL;
   g_autofree char *parent = NULL;
   g_autofree char *commit_checksum = NULL;
-  gs_unref_object GFile *root = NULL;
+  g_autoptr(GFile) root = NULL;
   gs_unref_variant GVariant *metadata = NULL;
   gs_unref_variant GVariant *detached_metadata = NULL;
   gs_unref_object OstreeMutableTree *mtree = NULL;
@@ -476,7 +476,7 @@ ostree_builtin_commit (int argc, char **argv, GCancellable *cancellable, GError
 
   if (opt_skip_if_unchanged && parent)
     {
-      gs_unref_object GFile *parent_root;
+      g_autoptr(GFile) parent_root;
 
       if (!ostree_repo_read_commit (repo, parent, &parent_root, NULL, cancellable, error))
         goto out;
diff --git a/src/ostree/ot-builtin-diff.c b/src/ostree/ot-builtin-diff.c
index 816b80e..11036e8 100644
--- a/src/ostree/ot-builtin-diff.c
+++ b/src/ostree/ot-builtin-diff.c
@@ -44,7 +44,7 @@ parse_file_or_commit (OstreeRepo  *repo,
                       GError     **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFile *ret_file = NULL;
+  g_autoptr(GFile) ret_file = NULL;
 
   if (g_str_has_prefix (arg, "/")
       || g_str_has_prefix (arg, "./")
@@ -124,8 +124,8 @@ ostree_builtin_diff (int argc, char **argv, GCancellable *cancellable, GError **
   const char *src;
   const char *target;
   g_autofree char *src_prev = NULL;
-  gs_unref_object GFile *srcf = NULL;
-  gs_unref_object GFile *targetf = NULL;
+  g_autoptr(GFile) srcf = NULL;
+  g_autoptr(GFile) targetf = NULL;
   gs_unref_ptrarray GPtrArray *modified = NULL;
   gs_unref_ptrarray GPtrArray *removed = NULL;
   gs_unref_ptrarray GPtrArray *added = NULL;
diff --git a/src/ostree/ot-builtin-fsck.c b/src/ostree/ot-builtin-fsck.c
index eb90eff..6ffe0e2 100644
--- a/src/ostree/ot-builtin-fsck.c
+++ b/src/ostree/ot-builtin-fsck.c
@@ -48,8 +48,8 @@ load_and_fsck_one_object (OstreeRepo            *repo,
   gboolean ret = FALSE;
   gboolean missing = FALSE;
   gs_unref_variant GVariant *metadata = NULL;
-  gs_unref_object GInputStream *input = NULL;
-  gs_unref_object GFileInfo *file_info = NULL;
+  g_autoptr(GInputStream) input = NULL;
+  g_autoptr(GFileInfo) file_info = NULL;
   gs_unref_variant GVariant *xattrs = NULL;
   GError *temp_error = NULL;
 
diff --git a/src/ostree/ot-builtin-ls.c b/src/ostree/ot-builtin-ls.c
index 1fce500..811abc2 100644
--- a/src/ostree/ot-builtin-ls.c
+++ b/src/ostree/ot-builtin-ls.c
@@ -154,9 +154,9 @@ print_directory_recurse (GFile    *f,
                          GError  **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFileEnumerator *dir_enum = NULL;
-  gs_unref_object GFile *child = NULL;
-  gs_unref_object GFileInfo *child_info = NULL;
+  g_autoptr(GFileEnumerator) dir_enum = NULL;
+  g_autoptr(GFile) child = NULL;
+  g_autoptr(GFileInfo) child_info = NULL;
   GError *temp_error = NULL;
 
   if (depth > 0)
@@ -207,8 +207,8 @@ print_one_argument (OstreeRepo   *repo,
                     GError      **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFile *f = NULL;
-  gs_unref_object GFileInfo *file_info = NULL;
+  g_autoptr(GFile) f = NULL;
+  g_autoptr(GFileInfo) file_info = NULL;
 
   f = g_file_resolve_relative_path (root, arg);
   
@@ -247,7 +247,7 @@ ostree_builtin_ls (int argc, char **argv, GCancellable *cancellable, GError **er
   gboolean ret = FALSE;
   const char *rev;
   int i;
-  gs_unref_object GFile *root = NULL;
+  g_autoptr(GFile) root = NULL;
 
   context = g_option_context_new ("COMMIT [PATH...] - List file paths");
 
diff --git a/src/ostree/ot-builtin-pull-local.c b/src/ostree/ot-builtin-pull-local.c
index 991cea1..40179f2 100644
--- a/src/ostree/ot-builtin-pull-local.c
+++ b/src/ostree/ot-builtin-pull-local.c
@@ -86,7 +86,7 @@ ostree_builtin_pull_local (int argc, char **argv, GCancellable *cancellable, GEr
 
   if (argc == 2)
     {
-      gs_unref_object GFile *src_repo_path = g_file_new_for_path (src_repo_arg);
+      g_autoptr(GFile) src_repo_path = g_file_new_for_path (src_repo_arg);
       gs_unref_object OstreeRepo *src_repo = ostree_repo_new (src_repo_path);
       gs_unref_hashtable GHashTable *refs_to_clone = NULL;
 
diff --git a/src/ostree/ot-builtin-show.c b/src/ostree/ot-builtin-show.c
index 4303c14..c25e30b 100644
--- a/src/ostree/ot-builtin-show.c
+++ b/src/ostree/ot-builtin-show.c
@@ -51,7 +51,7 @@ do_print_variant_generic (const GVariantType *type,
                           GError **error)
 {
   gboolean ret = FALSE;
-  gs_unref_object GFile *f = NULL;
+  g_autoptr(GFile) f = NULL;
   gs_unref_variant GVariant *variant = NULL;
 
   f = g_file_new_for_path (filename);
@@ -171,7 +171,7 @@ print_object (OstreeRepo          *repo,
     {
       gs_unref_object OstreeGpgVerifyResult *result = NULL;
       GError *local_error = NULL;
-      gs_unref_object GFile *gpg_homedir = opt_gpg_homedir ? g_file_new_for_path (opt_gpg_homedir) : NULL;
+      g_autoptr(GFile) gpg_homedir = opt_gpg_homedir ? g_file_new_for_path (opt_gpg_homedir) : NULL;
 
       result = ostree_repo_verify_commit_ext (repo, checksum,
                                               gpg_homedir, NULL, NULL,
@@ -309,7 +309,7 @@ ostree_builtin_show (int argc, char **argv, GCancellable *cancellable, GError **
             goto out;
           if (!found)
             {
-              gs_unref_object GFileInfo *finfo = NULL;
+              g_autoptr(GFileInfo) finfo = NULL;
               gs_unref_variant GVariant *xattrs = NULL;
               GFileType filetype;
               
diff --git a/src/ostree/ot-builtin-static-delta.c b/src/ostree/ot-builtin-static-delta.c
index 80f83b3..fba3d30 100644
--- a/src/ostree/ot-builtin-static-delta.c
+++ b/src/ostree/ot-builtin-static-delta.c
@@ -243,7 +243,7 @@ ot_static_delta_builtin_apply_offline (int argc, char **argv, GCancellable *canc
 {
   gboolean ret = FALSE;
   const char *patharg;
-  gs_unref_object GFile *path = NULL;
+  g_autoptr(GFile) path = NULL;
   GOptionContext *context;
   gs_unref_object OstreeRepo *repo = NULL;
 
diff --git a/src/ostree/ot-builtin-trivial-httpd.c b/src/ostree/ot-builtin-trivial-httpd.c
index 484c496..cde4abb 100644
--- a/src/ostree/ot-builtin-trivial-httpd.c
+++ b/src/ostree/ot-builtin-trivial-httpd.c
@@ -333,7 +333,7 @@ ostree_builtin_trivial_httpd (int argc, char **argv, GCancellable *cancellable,
   OtTrivialHttpd appstruct = { 0, };
   OtTrivialHttpd *app = &appstruct;
   gs_unref_object SoupServer *server = NULL;
-  gs_unref_object GFileMonitor *dirmon = NULL;
+  g_autoptr(GFileMonitor) dirmon = NULL;
 
   context = g_option_context_new ("[DIR] - Simple webserver");
 
@@ -363,8 +363,8 @@ ostree_builtin_trivial_httpd (int argc, char **argv, GCancellable *cancellable,
       g_autofree char *portstr = NULL;
 #if SOUP_CHECK_VERSION(2, 48, 0)
       GSList *listeners = soup_server_get_listeners (server);
-      gs_unref_object GSocket *listener = NULL;
-      gs_unref_object GSocketAddress *addr = NULL;
+      g_autoptr(GSocket) listener = NULL;
+      g_autoptr(GSocketAddress) addr = NULL;
       
       g_assert (listeners);
       listener = g_object_ref (listeners->data);
@@ -433,7 +433,7 @@ ostree_builtin_trivial_httpd (int argc, char **argv, GCancellable *cancellable,
   if (opt_autoexit)
     {
       gboolean is_symlink = FALSE;
-      gs_unref_object GFileInfo *info = NULL;
+      g_autoptr(GFileInfo) info = NULL;
 
       info = g_file_query_info (app->root,
                                G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK,
diff --git a/src/ostree/ot-editor.c b/src/ostree/ot-editor.c
index b84f687..b81312f 100644
--- a/src/ostree/ot-editor.c
+++ b/src/ostree/ot-editor.c
@@ -64,8 +64,8 @@ ot_editor_prompt (OstreeRepo *repo,
 {
   gs_unref_object GSSubprocessContext *ctx = NULL;
   gs_unref_object GSSubprocess *proc = NULL;
-  gs_unref_object GFile *file = NULL;
-  gs_unref_object GFileIOStream *io = NULL;
+  g_autoptr(GFile) file = NULL;
+  g_autoptr(GFileIOStream) io = NULL;
   GOutputStream *output;
   const char *editor;
   char *ret = NULL;
diff --git a/src/ostree/ot-main.c b/src/ostree/ot-main.c
index 595217e..14e9aa0 100644
--- a/src/ostree/ot-main.c
+++ b/src/ostree/ot-main.c
@@ -283,7 +283,7 @@ ostree_option_context_parse (GOptionContext *context,
     }
   else if (opt_repo != NULL)
     {
-      gs_unref_object GFile *repo_file = g_file_new_for_path (opt_repo);
+      g_autoptr(GFile) repo_file = g_file_new_for_path (opt_repo);
 
       repo = ostree_repo_new (repo_file);
       if (!(flags & OSTREE_BUILTIN_FLAG_NO_CHECK))
@@ -311,7 +311,7 @@ ostree_admin_option_context_parse (GOptionContext *context,
                                    GCancellable *cancellable,
                                    GError **error)
 {
-  gs_unref_object GFile *sysroot_path = NULL;
+  g_autoptr(GFile) sysroot_path = NULL;
   gs_unref_object OstreeSysroot *sysroot = NULL;
   gboolean success = FALSE;
 
@@ -341,7 +341,7 @@ ostree_admin_option_context_parse (GOptionContext *context,
     {
       gs_unref_ptrarray GPtrArray *deployments = NULL;
       OstreeDeployment *first_deployment;
-      gs_unref_object GFile *deployment_file = NULL;
+      g_autoptr(GFile) deployment_file = NULL;
       g_autofree char *deployment_path = NULL;
 
       if (!ostree_sysroot_load (sysroot, cancellable, error))
diff --git a/src/ostree/ot-remote-builtin-add.c b/src/ostree/ot-remote-builtin-add.c
index f6dbe53..36c5f95 100644
--- a/src/ostree/ot-remote-builtin-add.c
+++ b/src/ostree/ot-remote-builtin-add.c
@@ -46,7 +46,7 @@ ot_remote_builtin_add (int argc, char **argv, GCancellable *cancellable, GError
   const char *remote_url;
   char **iter;
   g_autofree char *target_name = NULL;
-  glnx_unref_object GFile *target_conf = NULL;
+  g_autoptr(GFile) target_conf = NULL;
   g_autoptr(GVariantBuilder) optbuilder = NULL;
   gboolean ret = FALSE;
 
diff --git a/tests/test-bsdiff.c b/tests/test-bsdiff.c
index 4078a2b..347de90 100644
--- a/tests/test-bsdiff.c
+++ b/tests/test-bsdiff.c
@@ -69,8 +69,8 @@ test_bsdiff (void)
   g_autofree guint8 *old = g_new (guint8, OLD_SIZE);
   g_autofree guint8 *new = g_new (guint8, NEW_SIZE);
   g_autofree guint8 *new_generated = g_new0 (guint8, NEW_SIZE);
-  gs_unref_object GOutputStream *out = g_memory_output_stream_new_resizable ();
-  gs_unref_object GInputStream *in = NULL;
+  g_autoptr(GOutputStream) out = g_memory_output_stream_new_resizable ();
+  g_autoptr(GInputStream) in = NULL;
 
   new[0] = 'A';
   for (i = 0; i < OLD_SIZE; i++)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]