tree-wide: Use g_autoptr(Ostree*)

Part of cleaning up our usage of libglnx; we want to use what's in GLib where we
can.

Had to change a few .c files to `#include ostree.h` early on to pick up
autoptrs for the core types.

Closes: #1040
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2017-08-03 13:48:12 +00:00
1 parent aa63d0e0c5
commit b929b620ae
47 files changed
+114 -110

No files matched your search

+7 -8
View File
@@ -22,10 +22,9 @@
#include "config.h"
#include "ostree.h"
#include "ostree-core-private.h"
#include "ostree-repo-private.h"
#include "ostree-repo-file.h"
#include "ostree-mutable-tree.h"
#ifdef HAVE_LIBARCHIVE
#include <archive.h>
@@ -185,7 +184,7 @@ mtree_ensure_dir_with_meta (OstreeRepo *repo,
GCancellable *cancellable,
GError **error)
{
glnx_unref_object OstreeMutableTree *dir = NULL;
g_autoptr(OstreeMutableTree) dir = NULL;
g_autofree guchar *csum_raw = NULL;
g_autofree char *csum = NULL;
@@ -374,7 +373,7 @@ aic_create_parent_dirs (OstreeRepoArchiveImportContext *ctx,
GError **error)
{
g_autofree char *fullpath = NULL;
glnx_unref_object OstreeMutableTree *dir = NULL;
g_autoptr(OstreeMutableTree) dir = NULL;
/* start with the root itself */
if (!aic_ensure_parent_dir (ctx, ctx->root, "/", &dir, cancellable, error))
@@ -643,7 +642,7 @@ aic_import_entry (OstreeRepoArchiveImportContext *ctx,
GError **error)
{
g_autoptr(GFileInfo) fi = NULL;
glnx_unref_object OstreeMutableTree *parent = NULL;
g_autoptr(OstreeMutableTree) parent = NULL;
g_autofree char *path = aic_get_final_entry_pathname (ctx, error);
if (path == NULL)
@@ -669,7 +668,7 @@ aic_import_from_hardlink (OstreeRepoArchiveImportContext *ctx,
const char *name = glnx_basename (target);
const char *name_dh = glnx_basename (dh->path);
g_autoptr(GPtrArray) components = NULL;
glnx_unref_object OstreeMutableTree *parent = NULL;
g_autoptr(OstreeMutableTree) parent = NULL;
if (!ostree_mutable_tree_lookup (dh->parent, name_dh, &csum, NULL, error))
return FALSE;
@@ -696,8 +695,8 @@ aic_lookup_file_csum (OstreeRepoArchiveImportContext *ctx,
{
g_autofree char *csum = NULL;
const char *name = glnx_basename (target);
glnx_unref_object OstreeMutableTree *parent = NULL;
glnx_unref_object OstreeMutableTree *subdir = NULL;
g_autoptr(OstreeMutableTree) parent = NULL;
g_autoptr(OstreeMutableTree) subdir = NULL;
g_autoptr(GPtrArray) components = NULL;
if (!ot_util_path_split_validate (target, &components, error))