Author: hwright Date: Tue Jun 28 18:45:31 2011 New Revision: 1140779 URL: http://svn.apache.org/viewvc?rev=1140779&view=rev Log: Collapse the scope on several variables in our codebase.
Found by: Philipp Kloke <[email protected]> * subversion/libsvn_fs_fs/tree.c (history_prev), * subversion/libsvn_subr/mergeinfo.c (combine_with_lastrange), * subversion/libsvn_subr/simple_providers.c (svn_auth__simple_first_creds_helper), * subversion/tests/libsvn_fs_base/fs-base-test.c (create_within_copy), * subversion/libsvn_wc/adm_ops.c (check_can_add_node), * subversion/libsvn_client/merge.c (remove_noop_merge_ranges, do_directory_merge), * subversion/libsvn_client/delete.c (svn_client_delete4): Tighten various variable scopes. Modified: subversion/trunk/subversion/libsvn_client/delete.c subversion/trunk/subversion/libsvn_client/merge.c subversion/trunk/subversion/libsvn_fs_fs/tree.c subversion/trunk/subversion/libsvn_subr/mergeinfo.c subversion/trunk/subversion/libsvn_subr/simple_providers.c subversion/trunk/subversion/libsvn_wc/adm_ops.c subversion/trunk/subversion/tests/libsvn_fs_base/fs-base-test.c Modified: subversion/trunk/subversion/libsvn_client/delete.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/delete.c?rev=1140779&r1=1140778&r2=1140779&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_client/delete.c (original) +++ subversion/trunk/subversion/libsvn_client/delete.c Tue Jun 28 18:45:31 2011 @@ -365,7 +365,6 @@ svn_client_delete4(const apr_array_heade apr_pool_t *pool) { svn_boolean_t is_url; - int i; if (! paths->nelts) return SVN_NO_ERROR; @@ -381,6 +380,7 @@ svn_client_delete4(const apr_array_heade else { apr_pool_t *subpool = svn_pool_create(pool); + int i; for (i = 0; i < paths->nelts; i++) { Modified: subversion/trunk/subversion/libsvn_client/merge.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1140779&r1=1140778&r2=1140779&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_client/merge.c (original) +++ subversion/trunk/subversion/libsvn_client/merge.c Tue Jun 28 18:45:31 2011 @@ -6105,7 +6105,6 @@ remove_noop_merge_ranges(apr_array_heade int i; svn_revnum_t oldest_rev = SVN_INVALID_REVNUM; svn_revnum_t youngest_rev = SVN_INVALID_REVNUM; - svn_revnum_t oldest_changed_rev, youngest_changed_rev; apr_array_header_t *changed_revs = apr_array_make(pool, ranges->nelts, sizeof(svn_revnum_t *)); apr_array_header_t *operative_ranges = @@ -6137,6 +6136,8 @@ remove_noop_merge_ranges(apr_array_heade /* Are there *any* changes? */ if (changed_revs->nelts) { + svn_revnum_t oldest_changed_rev, youngest_changed_rev; + /* Our list of changed revisions should be in youngest-to-oldest order. */ youngest_changed_rev = *(APR_ARRAY_IDX(changed_revs, @@ -8217,7 +8218,7 @@ do_directory_merge(svn_mergeinfo_catalog if (honor_mergeinfo && !merge_b->reintegrate_merge) { - svn_revnum_t new_range_start, start_rev, end_rev; + svn_revnum_t new_range_start, start_rev; apr_pool_t *iterpool = svn_pool_create(scratch_pool); /* The merge target TARGET_ABSPATH and/or its subtrees may not need all @@ -8260,7 +8261,7 @@ do_directory_merge(svn_mergeinfo_catalog /* Now examine NOTIFY_B->CHILDREN_WITH_MERGEINFO to find the youngest ending revision that actually needs to be merged (for reverse merges this is the oldest starting revision). */ - end_rev = + svn_revnum_t end_rev = get_most_inclusive_end_rev(notify_b->children_with_mergeinfo, is_rollback); Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/tree.c?rev=1140779&r1=1140778&r2=1140779&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_fs_fs/tree.c (original) +++ subversion/trunk/subversion/libsvn_fs_fs/tree.c Tue Jun 28 18:45:31 2011 @@ -3105,7 +3105,6 @@ history_prev(void *baton, apr_pool_t *po dag_node_t *node; svn_fs_root_t *root; svn_boolean_t reported = fhd->is_interesting; - svn_boolean_t retry = FALSE; svn_revnum_t copyroot_rev; const char *copyroot_path; @@ -3224,6 +3223,8 @@ history_prev(void *baton, apr_pool_t *po 'copy-style' history object. */ if (src_path && SVN_IS_VALID_REVNUM(src_rev)) { + svn_boolean_t retry = FALSE; + /* It's possible for us to find a copy location that is the same as the history point we've just reported. If that happens, we simply need to take another trip through this history Modified: subversion/trunk/subversion/libsvn_subr/mergeinfo.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/mergeinfo.c?rev=1140779&r1=1140778&r2=1140779&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_subr/mergeinfo.c (original) +++ subversion/trunk/subversion/libsvn_subr/mergeinfo.c Tue Jun 28 18:45:31 2011 @@ -371,7 +371,6 @@ combine_with_lastrange(const svn_merge_r svn_merge_range_t *r2 = svn_merge_range_dup(new_range, result_pool); svn_merge_range_t *r3 = NULL; - svn_revnum_t tmp_revnum; /* Pop off *LASTRANGE to make our manipulations easier. */ @@ -395,6 +394,8 @@ combine_with_lastrange(const svn_merge_r } else if (r1->start == r2->start) { + svn_revnum_t tmp_revnum; + /* *LASTRANGE and NEW_RANGE share an end point. */ tmp_revnum = r1->end; r1->end = r2->end; Modified: subversion/trunk/subversion/libsvn_subr/simple_providers.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/simple_providers.c?rev=1140779&r1=1140778&r2=1140779&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_subr/simple_providers.c (original) +++ subversion/trunk/subversion/libsvn_subr/simple_providers.c Tue Jun 28 18:45:31 2011 @@ -161,7 +161,6 @@ svn_auth__simple_first_creds_helper(void apr_hash_t *creds_hash = NULL; svn_error_t *err; svn_string_t *str; - svn_boolean_t have_passtype = FALSE; /* Try to load credentials from a file on disk, based on the realmstring. Don't throw an error, though: if something went @@ -178,6 +177,8 @@ svn_auth__simple_first_creds_helper(void else if (creds_hash) { /* We have something in the auth cache for this realm. */ + svn_boolean_t have_passtype = FALSE; + /* The password type in the auth data must match the mangler's type, otherwise the password must be interpreted by another provider. */ Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1140779&r1=1140778&r2=1140779&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original) +++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Tue Jun 28 18:45:31 2011 @@ -849,7 +849,6 @@ check_can_add_node(svn_node_kind_t *kind const char *base_name = svn_dirent_basename(local_abspath, scratch_pool); svn_boolean_t is_wc_root; svn_node_kind_t kind; - svn_boolean_t exists; SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath)); SVN_ERR_ASSERT(!copyfrom_url || (svn_uri_is_canonical(copyfrom_url, @@ -886,6 +885,7 @@ check_can_add_node(svn_node_kind_t *kind { svn_wc__db_status_t status; svn_boolean_t conflicted; + svn_boolean_t exists; svn_error_t *err = svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, Modified: subversion/trunk/subversion/tests/libsvn_fs_base/fs-base-test.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_fs_base/fs-base-test.c?rev=1140779&r1=1140778&r2=1140779&view=diff ============================================================================== --- subversion/trunk/subversion/tests/libsvn_fs_base/fs-base-test.c (original) +++ subversion/trunk/subversion/tests/libsvn_fs_base/fs-base-test.c Tue Jun 28 18:45:31 2011 @@ -1155,7 +1155,6 @@ create_within_copy(const svn_test_opts_t svn_fs_t *fs; svn_fs_txn_t *txn; svn_fs_root_t *txn_root, *rev_root; - int i; svn_revnum_t youngest_rev = 0; /* Create a filesystem and repository. */ @@ -1230,6 +1229,7 @@ create_within_copy(const svn_test_opts_t "A/D3/down", "A/D3/J" } }; + int i; SVN_ERR(svn_fs_revision_root(&rev_root, fs, youngest_rev, spool));
