Author: blair Date: Fri Apr 13 05:26:55 2012 New Revision: 1325616 URL: http://svn.apache.org/viewvc?rev=1325616&view=rev Log: Lift a constant function result out of several loops.
* subversion/libsvn_fs_fs/tree.c (merge): Instead of calling svn_fs_fs__fs_supports_mergeinfo(fs) many times, save it's result and use that throughout the function. Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/tree.c?rev=1325616&r1=1325615&r2=1325616&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_fs_fs/tree.c (original) +++ subversion/trunk/subversion/libsvn_fs_fs/tree.c Fri Apr 13 05:26:55 2012 @@ -1198,6 +1198,7 @@ merge(svn_stringbuf_t *conflict_p, svn_fs_t *fs; apr_pool_t *iterpool; apr_int64_t mergeinfo_increment = 0; + svn_boolean_t fs_supports_mergeinfo; /* Make sure everyone comes from the same filesystem. */ fs = svn_fs_fs__dag_get_fs(ancestor); @@ -1345,6 +1346,8 @@ merge(svn_stringbuf_t *conflict_p, SVN_ERR(svn_fs_fs__dag_dir_entries(&t_entries, target, pool)); SVN_ERR(svn_fs_fs__dag_dir_entries(&a_entries, ancestor, pool)); + fs_supports_mergeinfo = svn_fs_fs__fs_supports_mergeinfo(fs); + /* for each entry E in a_entries... */ iterpool = svn_pool_create(pool); for (hi = apr_hash_first(pool, a_entries); @@ -1376,7 +1379,7 @@ merge(svn_stringbuf_t *conflict_p, dag_node_t *t_ent_node; SVN_ERR(svn_fs_fs__dag_get_node(&t_ent_node, fs, t_entry->id, iterpool)); - if (svn_fs_fs__fs_supports_mergeinfo(fs)) + if (fs_supports_mergeinfo) { apr_int64_t mergeinfo_start; SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_start, @@ -1390,7 +1393,7 @@ merge(svn_stringbuf_t *conflict_p, SVN_ERR(svn_fs_fs__dag_get_node(&s_ent_node, fs, s_entry->id, iterpool)); - if (svn_fs_fs__fs_supports_mergeinfo(fs)) + if (fs_supports_mergeinfo) { apr_int64_t mergeinfo_end; SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_end, @@ -1467,7 +1470,7 @@ merge(svn_stringbuf_t *conflict_p, txn_id, &sub_mergeinfo_increment, iterpool)); - if (svn_fs_fs__fs_supports_mergeinfo(fs)) + if (fs_supports_mergeinfo) mergeinfo_increment += sub_mergeinfo_increment; } @@ -1503,7 +1506,7 @@ merge(svn_stringbuf_t *conflict_p, SVN_ERR(svn_fs_fs__dag_get_node(&s_ent_node, fs, s_entry->id, iterpool)); - if (svn_fs_fs__fs_supports_mergeinfo(fs)) + if (fs_supports_mergeinfo) { apr_int64_t mergeinfo_s; SVN_ERR(svn_fs_fs__dag_get_mergeinfo_count(&mergeinfo_s, @@ -1519,7 +1522,7 @@ merge(svn_stringbuf_t *conflict_p, SVN_ERR(svn_fs_fs__dag_update_ancestry(target, source, pool)); - if (svn_fs_fs__fs_supports_mergeinfo(fs)) + if (fs_supports_mergeinfo) SVN_ERR(svn_fs_fs__dag_increment_mergeinfo_count(target, mergeinfo_increment, pool));