Merge pull request #2196 from cgwalters/commit-shadowing-fix

commit: Tighten scope of two variables
This commit is contained in:
OpenShift Merge Robot 2020-09-13 13:00:16 -04:00 committed by GitHub
commit 9c040c1a73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 17 deletions

View File

@ -3943,11 +3943,9 @@ write_dfd_iter_to_mtree_internal (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
g_autoptr(GFileInfo) child_info = NULL;
g_autoptr(GFileInfo) modified_info = NULL; g_autoptr(GFileInfo) modified_info = NULL;
g_autoptr(GVariant) xattrs = NULL; g_autoptr(GVariant) xattrs = NULL;
g_autofree guchar *child_file_csum = NULL; g_autofree guchar *child_file_csum = NULL;
g_autofree char *tmp_checksum = NULL;
g_autofree char *relpath = NULL; g_autofree char *relpath = NULL;
OstreeRepoCommitFilterResult filter_result; OstreeRepoCommitFilterResult filter_result;
struct stat dir_stbuf; struct stat dir_stbuf;
@ -3955,12 +3953,11 @@ write_dfd_iter_to_mtree_internal (OstreeRepo *self,
if (!glnx_fstat (src_dfd_iter->fd, &dir_stbuf, error)) if (!glnx_fstat (src_dfd_iter->fd, &dir_stbuf, error))
return FALSE; return FALSE;
child_info = _ostree_stbuf_to_gfileinfo (&dir_stbuf); {
g_autoptr(GFileInfo) child_info = _ostree_stbuf_to_gfileinfo (&dir_stbuf);
if (modifier != NULL) if (modifier != NULL)
{ {
relpath = ptrarray_path_join (path); relpath = ptrarray_path_join (path);
filter_result = _ostree_repo_commit_modifier_apply (self, modifier, relpath, child_info, &modified_info); filter_result = _ostree_repo_commit_modifier_apply (self, modifier, relpath, child_info, &modified_info);
} }
else else
@ -3968,6 +3965,7 @@ write_dfd_iter_to_mtree_internal (OstreeRepo *self,
filter_result = OSTREE_REPO_COMMIT_FILTER_ALLOW; filter_result = OSTREE_REPO_COMMIT_FILTER_ALLOW;
modified_info = g_object_ref (child_info); modified_info = g_object_ref (child_info);
} }
}
if (filter_result == OSTREE_REPO_COMMIT_FILTER_ALLOW) if (filter_result == OSTREE_REPO_COMMIT_FILTER_ALLOW)
{ {
@ -3979,8 +3977,7 @@ write_dfd_iter_to_mtree_internal (OstreeRepo *self,
cancellable, error)) cancellable, error))
return FALSE; return FALSE;
g_free (tmp_checksum); g_autofree char *tmp_checksum = ostree_checksum_from_bytes (child_file_csum);
tmp_checksum = ostree_checksum_from_bytes (child_file_csum);
ostree_mutable_tree_set_metadata_checksum (mtree, tmp_checksum); ostree_mutable_tree_set_metadata_checksum (mtree, tmp_checksum);
} }