mtree: Use declare-and-initialize style
authorColin Walters <walters@verbum.org>
Fri, 18 Feb 2022 15:22:26 +0000 (10:22 -0500)
committerColin Walters <walters@verbum.org>
Fri, 18 Feb 2022 15:22:26 +0000 (10:22 -0500)
Prep for further work.

src/libostree/ostree-mutable-tree.c

index 91023ca92d51e29120745bcacb3739ae94f6363d..e0e73f3704f61e3b20f8e7f3e16a44604edc5a24 100644 (file)
@@ -463,13 +463,11 @@ ostree_mutable_tree_ensure_parent_dirs (OstreeMutableTree  *self,
   OstreeMutableTree *subdir = self; /* nofree */
   for (guint i = 0; i+1 < split_path->len; i++)
     {
-      OstreeMutableTree *next;
       const char *name = split_path->pdata[i];
-
       if (g_hash_table_lookup (subdir->files, name))
         return glnx_throw (error, "Can't replace file with directory: %s", name);
 
-      next = g_hash_table_lookup (subdir->subdirs, name);
+      OstreeMutableTree *next = g_hash_table_lookup (subdir->subdirs, name);
       if (!next)
         {
           invalidate_contents_checksum (subdir);
@@ -580,11 +578,9 @@ ostree_mutable_tree_walk (OstreeMutableTree     *self,
     }
   else
     {
-      OstreeMutableTree *subdir;
       if (!_ostree_mutable_tree_make_whole (self, NULL, error))
         return FALSE;
-
-      subdir = g_hash_table_lookup (self->subdirs, split_path->pdata[start]);
+      OstreeMutableTree *subdir = g_hash_table_lookup (self->subdirs, split_path->pdata[start]);
       if (!subdir)
         return set_error_noent (error, (char*)split_path->pdata[start]);