[ostree] repo: Deduplicate some code in load_file
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] repo: Deduplicate some code in load_file
- Date: Mon, 12 Jan 2015 20:11:26 +0000 (UTC)
commit 25a590950095e501c1f3a56be91d7cb97794cb5a
Author: Colin Walters <walters verbum org>
Date: Mon Jan 12 12:10:02 2015 -0500
repo: Deduplicate some code in load_file
src/libostree/ostree-repo.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 942c24a..d82872c 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -1875,18 +1875,18 @@ ostree_repo_load_file (OstreeRepo *self,
gs_unref_object GInputStream *ret_input = NULL;
gs_unref_object GFileInfo *ret_file_info = NULL;
gs_unref_variant GVariant *ret_xattrs = NULL;
+ char loose_path_buf[_OSTREE_LOOSE_PATH_MAX];
repo_mode = ostree_repo_get_mode (self);
+ _ostree_loose_path (loose_path_buf, checksum, OSTREE_OBJECT_TYPE_FILE, repo_mode);
+
if (repo_mode == OSTREE_REPO_MODE_ARCHIVE_Z2)
{
- char loose_path_buf[_OSTREE_LOOSE_PATH_MAX];
int fd = -1;
struct stat stbuf;
gs_unref_object GInputStream *tmp_stream = NULL;
- _ostree_loose_path (loose_path_buf, checksum, OSTREE_OBJECT_TYPE_FILE, self->mode);
-
if (!openat_allow_noent (self->objects_dir_fd, loose_path_buf, &fd,
cancellable, error))
goto out;
@@ -1911,10 +1911,6 @@ ostree_repo_load_file (OstreeRepo *self,
}
else
{
- char loose_path_buf[_OSTREE_LOOSE_PATH_MAX];
-
- _ostree_loose_path (loose_path_buf, checksum, OSTREE_OBJECT_TYPE_FILE, self->mode);
-
if (!query_info_for_bare_content_object (self, loose_path_buf,
&ret_file_info,
cancellable, error))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]