[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] simple refactoring in the merge-tracking code

From: Madan U Sreenivasan <madan_at_collab.net>
Date: 2006-07-06 14:37:13 CEST

Hi,

    While reading through the rangelist_intersect_or_remove() function of
subversion/libsvn_subr/mergeinfo.c, I found this place where we could
factor out common code (though I dont understand
rangelist_intersect_or_remove fully yet). The attached patch does this.

[[[
Simple refactoring in the merge-tracking code.

(In branches/merge-tracking)

* subversion/libsvn_subr/mergeinfo.c:
   (rangelist_intersect_or_remove): Move common code outside the if-else
    construct.
]]]

Regards,
Madan.

Index: subversion/libsvn_subr/mergeinfo.c
===================================================================
--- subversion/libsvn_subr/mergeinfo.c (revision 20444)
+++ subversion/libsvn_subr/mergeinfo.c (working copy)
@@ -464,13 +464,6 @@
                   /* Retain the range that falls before the eraser start. */
                   tmp_range.start = elt1->start;
                   tmp_range.end = elt2->start - 1;
-
- if (!lastrange || !svn_combine_ranges(&lastrange, lastrange,
- &tmp_range))
- {
- lastrange = svn_range_dup(&tmp_range, pool);
- APR_ARRAY_PUSH(*output, svn_merge_range_t *) = lastrange;
- }
                 }
               else
                 {
@@ -478,15 +471,15 @@
                      start and whiteboard end. */
                   tmp_range.start = elt2->start;
                   tmp_range.end = elt1->end;
+ }
 
- if (!lastrange || !svn_combine_ranges(&lastrange, lastrange,
- &tmp_range))
- {
- lastrange = svn_range_dup(&tmp_range, pool);
- APR_ARRAY_PUSH(*output, svn_merge_range_t *) = lastrange;
- }
-
+ if (!lastrange || !svn_combine_ranges(&lastrange, lastrange,
+ &tmp_range))
+ {
+ lastrange = svn_range_dup(&tmp_range, pool);
+ APR_ARRAY_PUSH(*output, svn_merge_range_t *) = lastrange;
                 }
+
             }
 
           /* Set up the rest of the whiteboard range for further

Simple refactoring in the merge-tracking code.

(In branches/merge-tracking)

* subversion/libsvn_subr/mergeinfo.c:
  (rangelist_intersect_or_remove): Move common code outside the if-else
   construct.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Jul 6 14:07:06 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.