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

[PATCH] [merge-tracking] clarity fix for subversion/libsvn_subr/mergeinfo.c

From: Kamesh Jayachandran <kamesh_at_collab.net>
Date: 2006-07-08 20:42:09 CEST

Hi All,
Find the attached patch.

With regards
Kamesh Jayachandran

[[[
Patch by: Kamesh Jayachandran <kamesh@collab.net>

Had a tough time initially in understanding what 'elt2 & elt1' is
120 lines of while loop. Though my mind now can easily map what
'elt2 & elt1' is, it would have saved few minutes if names had been
bit more hinting.

Doc correction to function header 'parse_revlist'.

* subversion/libsvn_subr/mergeinfo.c
  (parse_revlist):
   Doc header fix as follows,
   Typo fix 'revisioneelement' -> 'revisionelement',
   'revisionrange | REVISION' -> 'revisionelement' in defining
'revisionlist'.

  (rangelist_intersect_or_remove):
   Variable name change from 'elt1' to 'cur_wboard_range'
   'elt2' to 'cur_erase_range'.

]]]

Index: subversion/libsvn_subr/mergeinfo.c
===================================================================
--- subversion/libsvn_subr/mergeinfo.c (revision 20478)
+++ subversion/libsvn_subr/mergeinfo.c (working copy)
@@ -129,9 +129,9 @@
 }
 
 
-/* revisionlist -> (revisionrange | REVISION)(COMMA revisioneelement)*
+/* revisionlist -> (revisionelement)(COMMA revisionelement)*
    revisionrange -> REVISION "-" REVISION
- revisioneelement -> revisionrange | REVISION
+ revisionelement -> revisionrange | REVISION
 */
 static svn_error_t *
 parse_revlist(const char **input, const char *end,
@@ -414,9 +414,9 @@
 
   while (i < whiteboard->nelts && j < eraser->nelts)
     {
- svn_merge_range_t *elt1, *elt2;
+ svn_merge_range_t *cur_wboard_range, *cur_erase_range;
 
- elt2 = APR_ARRAY_IDX(eraser, j, svn_merge_range_t *);
+ cur_erase_range = APR_ARRAY_IDX(eraser, j, svn_merge_range_t *);
 
       /* Instead of making a copy of the entire array of whiteboard
          elements, we just keep a copy of the current whiteboard element
@@ -424,7 +424,7 @@
       if (i != lasti)
         {
           wboardelt = *(APR_ARRAY_IDX(whiteboard, i, svn_merge_range_t *));
- elt1 = &wboardelt;
+ cur_wboard_range = &wboardelt;
           lasti = i;
         }
 
@@ -436,41 +436,42 @@
          the removal of eraser from whiteboard, and possibly change
          the whiteboard to the remaining portion of the right part of
          the removal, to test against. */
- if (range_contains(elt2, elt1))
+ if (range_contains(cur_erase_range, cur_wboard_range))
         {
           if (!do_remove)
             {
               if (!lastrange || !svn_combine_ranges(&lastrange, lastrange,
- elt1))
+ cur_wboard_range))
                 {
- lastrange = svn_range_dup(elt1, pool);
+ lastrange = svn_range_dup(cur_wboard_range, pool);
                   APR_ARRAY_PUSH(*output, svn_merge_range_t *) = lastrange;
                 }
             }
           
           i++;
 
- if (elt1->start == elt2->start && elt1->end == elt2->end)
+ if (cur_wboard_range->start == cur_erase_range->start
+ && cur_wboard_range->end == cur_erase_range->end)
             j++;
         }
- else if (range_intersect(elt2, elt1))
+ else if (range_intersect(cur_erase_range, cur_wboard_range))
         {
- if (elt1->start < elt2->start)
+ if (cur_wboard_range->start < cur_erase_range->start)
             {
               /* The whiteboard range starts before the eraser range. */
               svn_merge_range_t tmp_range;
               if (do_remove)
                 {
                   /* Retain the range that falls before the eraser start. */
- tmp_range.start = elt1->start;
- tmp_range.end = elt2->start - 1;
+ tmp_range.start = cur_wboard_range->start;
+ tmp_range.end = cur_erase_range->start - 1;
                 }
               else
                 {
                   /* Retain the range that falls between the eraser
                      start and whiteboard end. */
- tmp_range.start = elt2->start;
- tmp_range.end = elt1->end;
+ tmp_range.start = cur_erase_range->start;
+ tmp_range.end = cur_wboard_range->end;
                 }
 
               if (!lastrange || !svn_combine_ranges(&lastrange, lastrange,
@@ -483,15 +484,15 @@
 
           /* Set up the rest of the whiteboard range for further
              processing. */
- if (elt1->end > elt2->end)
+ if (cur_wboard_range->end > cur_erase_range->end)
             {
               /* The whiteboard range ends after the eraser range. */
               if (!do_remove)
                 {
                   /* Partial overlap. */
                   svn_merge_range_t tmp_range;
- tmp_range.start = elt1->start;
- tmp_range.end = elt2->end;
+ tmp_range.start = cur_wboard_range->start;
+ tmp_range.end = cur_erase_range->end;
                   
                   if (!lastrange || !svn_combine_ranges(&lastrange, lastrange,
                                                         &tmp_range))
@@ -501,8 +502,8 @@
                     }
                 }
 
- wboardelt.start = elt2->end + 1;
- wboardelt.end = elt1->end;
+ wboardelt.start = cur_erase_range->end + 1;
+ wboardelt.end = cur_wboard_range->end;
             }
           else
             i++;
@@ -515,16 +516,16 @@
              If it is on past the whiteboard on the right side, we
              need to output the whiteboard and increment the
              whiteboard. */
- if (svn_sort_compare_ranges(&elt2, &elt1) < 0)
+ if (svn_sort_compare_ranges(&cur_erase_range, &cur_wboard_range) < 0)
             j++;
           else
             {
               if (!lastrange || !svn_combine_ranges(&lastrange, lastrange,
- elt1))
+ cur_wboard_range))
                 {
                   if (do_remove)
                     {
- lastrange = svn_range_dup(elt1, pool);
+ lastrange = svn_range_dup(cur_wboard_range, pool);
                       APR_ARRAY_PUSH(*output, svn_merge_range_t *) = lastrange;
                     }
                 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jul 8 20:41:05 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.