diff options
author | Jonathan Lebon <jlebon@redhat.com> | 2016-04-08 12:18:17 -0400 |
---|---|---|
committer | Colin Walters (automation) <walters+githubbot@verbum.org> | 2016-04-08 18:43:18 +0000 |
commit | 41661e47e18856a9886fa37bdb83c8765ed057be (patch) | |
tree | aa9e884a15f134b07224bbbf147475c748dca0da /src/libostree/ostree-repo-file.c | |
parent | ddda8e5b8bb1ec21b2a4c5340dc36362c59c1271 (diff) | |
download | ostree-41661e47e18856a9886fa37bdb83c8765ed057be.tar.gz |
small cleanups
- Revert 'cannot' --> 'can not' (it's the exception!)
- Remove duplicate function
- Squelch compiler warnings
Closes: #248
Approved by: cgwalters
Diffstat (limited to 'src/libostree/ostree-repo-file.c')
-rw-r--r-- | src/libostree/ostree-repo-file.c | 50 |
1 files changed, 2 insertions, 48 deletions
diff --git a/src/libostree/ostree-repo-file.c b/src/libostree/ostree-repo-file.c index 49f7333d..396820da 100644 --- a/src/libostree/ostree-repo-file.c +++ b/src/libostree/ostree-repo-file.c @@ -745,52 +745,6 @@ query_child_info_dir (OstreeRepo *repo, return ret; } -static gboolean -bsearch_in_file_variant (GVariant *variant, - const char *name, - int *out_pos) -{ - gsize imax, imin; - gsize imid; - gsize n; - - n = g_variant_n_children (variant); - if (n == 0) - return FALSE; - - imax = n - 1; - imin = 0; - while (imax >= imin) - { - g_autoptr(GVariant) child = NULL; - const char *cur; - int cmp; - - imid = (imin + imax) / 2; - - child = g_variant_get_child_value (variant, imid); - g_variant_get_child (child, 0, "&s", &cur, NULL); - - cmp = strcmp (cur, name); - if (cmp < 0) - imin = imid + 1; - else if (cmp > 0) - { - if (imid == 0) - break; - imax = imid - 1; - } - else - { - *out_pos = imid; - return TRUE; - } - } - - *out_pos = imid; - return FALSE; -} - int ostree_repo_file_tree_find_child (OstreeRepoFile *self, const char *name, @@ -806,7 +760,7 @@ ostree_repo_file_tree_find_child (OstreeRepoFile *self, dirs_variant = g_variant_get_child_value (self->tree_contents, 1); i = -1; - if (bsearch_in_file_variant (files_variant, name, &i)) + if (ot_variant_bsearch_str (files_variant, name, &i)) { *is_dir = FALSE; ret_container = files_variant; @@ -814,7 +768,7 @@ ostree_repo_file_tree_find_child (OstreeRepoFile *self, } else { - if (bsearch_in_file_variant (dirs_variant, name, &i)) + if (ot_variant_bsearch_str (dirs_variant, name, &i)) { *is_dir = TRUE; ret_container = dirs_variant; |