[ostree: 54/70] small cleanups



commit 41661e47e18856a9886fa37bdb83c8765ed057be
Author: Jonathan Lebon <jlebon redhat com>
Date:   Fri Apr 8 12:18:17 2016 -0400

    small cleanups
    
    - Revert 'cannot' --> 'can not' (it's the exception!)
    - Remove duplicate function
    - Squelch compiler warnings
    
    Closes: #248
    Approved by: cgwalters

 cfg.mk                           |    2 +-
 docs/manual/related-projects.md  |    2 +-
 src/libostree/ostree-metalink.c  |    4 +-
 src/libostree/ostree-repo-file.c |   50 +------------------------------------
 src/libotutil/ot-variant-utils.c |    4 +-
 5 files changed, 8 insertions(+), 54 deletions(-)
---
diff --git a/cfg.mk b/cfg.mk
index 3806209..d6a5039 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1,4 +1,4 @@
-export 
VC_LIST_EXCEPT_DEFAULT=^(git.mk|lib/.*|m4/.*|md5/.*|build-aux/.*|src/gettext\.h|.*ChangeLog|buildutil/.*)$$
+export 
VC_LIST_EXCEPT_DEFAULT=^(docs/.*|git.mk|lib/.*|m4/.*|md5/.*|build-aux/.*|src/gettext\.h|.*ChangeLog|buildutil/.*)$$
 
 local-checks-to-skip = \
     sc_const_long_option \
diff --git a/docs/manual/related-projects.md b/docs/manual/related-projects.md
index 7397233..896c765 100644
--- a/docs/manual/related-projects.md
+++ b/docs/manual/related-projects.md
@@ -63,7 +63,7 @@ awareness of BTRFS in dpkg/rpm itself) will be required.
 The OSTree author believes that having total freedom at the block
 storage layer is better for general purpose operating systems. For
 example, with OSTree, one is free to use BTRFS in any way you like -
-you can use a subvolume for `/home`, or you cannot.
+you may decide to use a subvolume for `/home`, or not.
 
 Furthermore, in its most basic incarnation, the rpm/dpkg + BTRFS
 doesn't solve the race conditions that happen when unpacking packages
diff --git a/src/libostree/ostree-metalink.c b/src/libostree/ostree-metalink.c
index 5ca69e6..ad3a6a2 100644
--- a/src/libostree/ostree-metalink.c
+++ b/src/libostree/ostree-metalink.c
@@ -491,7 +491,7 @@ try_metalink_targets (OstreeMetalinkRequest      *self,
                       GError                    **error)
 {
   gboolean ret = FALSE;
-  SoupURI *target_uri;
+  SoupURI *target_uri = NULL;
 
   if (!self->found_a_file_element)
     {
@@ -564,7 +564,7 @@ try_metalink_targets (OstreeMetalinkRequest      *self,
                    self->urls->len, self->last_metalink_error);
       goto out;
     }
-  
+
   ret = TRUE;
   if (out_target_uri)
     *out_target_uri = soup_uri_copy (target_uri);
diff --git a/src/libostree/ostree-repo-file.c b/src/libostree/ostree-repo-file.c
index 49f7333..396820d 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;
diff --git a/src/libotutil/ot-variant-utils.c b/src/libotutil/ot-variant-utils.c
index 0305c34..2dc0758 100644
--- a/src/libotutil/ot-variant-utils.c
+++ b/src/libotutil/ot-variant-utils.c
@@ -319,7 +319,7 @@ ot_variant_bsearch_str (GVariant   *array,
                         int        *out_pos)
 {
   gsize imax, imin;
-  gsize imid;
+  gsize imid = -1;
   gsize n;
 
   n = g_variant_n_children (array);
@@ -337,7 +337,7 @@ ot_variant_bsearch_str (GVariant   *array,
       imid = (imin + imax) / 2;
 
       child = g_variant_get_child_value (array, imid);
-      g_variant_get_child (child, 0, "&s", &cur, NULL);      
+      g_variant_get_child (child, 0, "&s", &cur, NULL);
 
       cmp = strcmp (cur, str);
       if (cmp < 0)


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