[ostree] repo: Drop ostree_repo_load_variant_c API



commit 356de33b490b6dbb7911582aeb09b906a7d26259
Author: Colin Walters <walters verbum org>
Date:   Tue Sep 3 18:23:11 2013 -0400

    repo: Drop ostree_repo_load_variant_c API
    
    Originally we had this to avoid forcing callers to malloc() if they
    had a csum, but nowadays we have in-place conversion APIs that are
    fast enough.

 doc/ostree-sections.txt          |    1 -
 src/libostree/ostree-repo-file.c |   19 ++++++++++++-------
 src/libostree/ostree-repo.c      |   31 -------------------------------
 src/libostree/ostree-repo.h      |    6 ------
 4 files changed, 12 insertions(+), 45 deletions(-)
---
diff --git a/doc/ostree-sections.txt b/doc/ostree-sections.txt
index e2686fb..570c327 100644
--- a/doc/ostree-sections.txt
+++ b/doc/ostree-sections.txt
@@ -90,7 +90,6 @@ ostree_repo_resolve_rev
 ostree_repo_write_ref
 ostree_repo_write_refspec
 ostree_repo_list_refs
-ostree_repo_load_variant_c
 ostree_repo_load_variant
 ostree_repo_load_variant_if_exists
 ostree_repo_load_file
diff --git a/src/libostree/ostree-repo-file.c b/src/libostree/ostree-repo-file.c
index 9d1650b..6ff7b12 100644
--- a/src/libostree/ostree-repo-file.c
+++ b/src/libostree/ostree-repo-file.c
@@ -169,6 +169,7 @@ do_resolve_commit (OstreeRepoFile  *self,
   gs_unref_variant GVariant *root_metadata = NULL;
   gs_unref_variant GVariant *tree_contents_csum_v = NULL;
   gs_unref_variant GVariant *tree_metadata_csum_v = NULL;
+  char tmp_checksum[65];
 
   g_assert (self->parent == NULL);
 
@@ -178,16 +179,20 @@ do_resolve_commit (OstreeRepoFile  *self,
 
   /* PARSE OSTREE_OBJECT_TYPE_COMMIT */
   g_variant_get_child (commit, 6, "@ay", &tree_contents_csum_v);
-  g_variant_get_child (commit, 7, "@ay", &tree_metadata_csum_v);
 
-  if (!ostree_repo_load_variant_c (self->repo, OSTREE_OBJECT_TYPE_DIR_TREE,
-                                   ostree_checksum_bytes_peek (tree_contents_csum_v),
-                                   &root_contents, error))
+  ostree_checksum_inplace_from_bytes (g_variant_get_data (tree_contents_csum_v), tmp_checksum);
+
+  if (!ostree_repo_load_variant (self->repo, OSTREE_OBJECT_TYPE_DIR_TREE,
+                                 tmp_checksum,
+                                 &root_contents, error))
     goto out;
 
-  if (!ostree_repo_load_variant_c (self->repo, OSTREE_OBJECT_TYPE_DIR_META,
-                                   ostree_checksum_bytes_peek (tree_metadata_csum_v),
-                                   &root_metadata, error))
+  g_variant_get_child (commit, 7, "@ay", &tree_metadata_csum_v);
+  ostree_checksum_inplace_from_bytes (g_variant_get_data (tree_metadata_csum_v), tmp_checksum);
+
+  if (!ostree_repo_load_variant (self->repo, OSTREE_OBJECT_TYPE_DIR_META,
+                                 tmp_checksum,
+                                 &root_metadata, error))
     goto out;
   
   self->tree_metadata = root_metadata;
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index b44401c..8d86895 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -2585,37 +2585,6 @@ ostree_repo_query_object_storage_size (OstreeRepo           *self,
 }
 
 /**
- * ostree_repo_load_variant_c:
- * @self: Repo
- * @objtype: Expected object type
- * @csum: Binary checksum
- * @out_variant: (out): (transfer full): Metadata object
- * @error: Error
- * 
- * Load the metadata object @csum of type @objtype, storing the
- * result in @out_variant.
- */
-gboolean
-ostree_repo_load_variant_c (OstreeRepo          *self,
-                            OstreeObjectType     objtype,
-                            const guchar        *csum, 
-                            GVariant           **out_variant,
-                            GError             **error)
-{
-  gboolean ret = FALSE;
-  gs_free char *checksum = NULL;
-
-  checksum = ostree_checksum_from_bytes (csum);
-
-  if (!ostree_repo_load_variant (self, objtype, checksum, out_variant, error))
-    goto out;
-
-  ret = TRUE;
- out:
-  return ret;
-}
-
-/**
  * ostree_repo_load_variant_if_exists:
  * @self: Repo
  * @objtype: Object type
diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h
index 73637c1..2465f51 100644
--- a/src/libostree/ostree-repo.h
+++ b/src/libostree/ostree-repo.h
@@ -181,12 +181,6 @@ gboolean      ostree_repo_list_refs (OstreeRepo       *self,
                                      GCancellable     *cancellable,
                                      GError          **error);
 
-gboolean      ostree_repo_load_variant_c (OstreeRepo  *self,
-                                          OstreeObjectType objtype,
-                                          const guchar  *csum,       
-                                          GVariant     **out_variant,
-                                          GError       **error);
-
 gboolean      ostree_repo_load_variant (OstreeRepo  *self,
                                         OstreeObjectType objtype,
                                         const char    *sha256, 


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