summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-repo-static-delta-processing.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2017-10-08 15:55:35 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2017-10-11 19:04:46 +0000
commitbb51a43d8111416bdd8225487ba803c34ad5b69b (patch)
treea9e6a42e56de43954b286c5d8c152e516b0b2974 /src/libostree/ostree-repo-static-delta-processing.c
parentd10593e65d504fd523ddfae5309a51ef189c841e (diff)
downloadostree-bb51a43d8111416bdd8225487ba803c34ad5b69b.tar.gz
lib/core: Use GBytes for file headers
This simplifies a lot of code; the header function was structured to write to an input stream, but many callers only wanted the checksum, so it's simpler (and error-free) to simply allocate a whole buffer and checksum that. For the callers that want to write it, it's also still simpler to allocate the buffer and write the whole thing rather than having this function do the writing. A lot of the complexity here again is a legacy of the packfile code, which is dead. This is prep for faster regfile commits where we can avoid `G{In,Out}putStream`. Closes: #1257 Approved by: jlebon
Diffstat (limited to 'src/libostree/ostree-repo-static-delta-processing.c')
-rw-r--r--src/libostree/ostree-repo-static-delta-processing.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/libostree/ostree-repo-static-delta-processing.c b/src/libostree/ostree-repo-static-delta-processing.c
index 092b6ea7..bf32e02e 100644
--- a/src/libostree/ostree-repo-static-delta-processing.c
+++ b/src/libostree/ostree-repo-static-delta-processing.c
@@ -501,13 +501,10 @@ handle_untrusted_content_checksum (OstreeRepo *repo,
GError **error)
{
g_autoptr(GFileInfo) finfo = _ostree_mode_uidgid_to_gfileinfo (state->mode, state->uid, state->gid);
- g_autoptr(GVariant) header = _ostree_file_header_new (finfo, state->xattrs);
+ g_autoptr(GBytes) header = _ostree_file_header_new (finfo, state->xattrs);
ot_checksum_init (&state->content_checksum);
-
- if (!_ostree_write_variant_with_size (NULL, header, &state->content_checksum,
- cancellable, error))
- return FALSE;
+ ot_checksum_update_bytes (&state->content_checksum, header);
return TRUE;
}