subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1813013 - /subversion/trunk/subversion/libsvn_subr/mergeinfo.c
Date Mon, 23 Oct 2017 12:29:32 GMT
Author: rhuijben
Date: Mon Oct 23 12:29:32 2017
New Revision: 1813013

URL: http://svn.apache.org/viewvc?rev=1813013&view=rev
Log:
* subversion/libsvn_subr/mergeinfo.c
  (combine_with_lastrange): Following up on r1813012, update indentation.
    No functional changes.

Modified:
    subversion/trunk/subversion/libsvn_subr/mergeinfo.c

Modified: subversion/trunk/subversion/libsvn_subr/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/mergeinfo.c?rev=1813013&r1=1813012&r2=1813013&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_subr/mergeinfo.c Mon Oct 23 12:29:32 2017
@@ -286,171 +286,171 @@ combine_with_lastrange(const svn_merge_r
     }
   else /* Considering inheritance */
     {
-          /* If we are here then the ranges either don't intersect or do
-             intersect but have differing inheritability.  Check for the
-             first case as that is easy to handle. */
-          intersection_type_t intersection_type;
-          svn_boolean_t sorted = FALSE;
+      /* If we are here then the ranges either don't intersect or do
+          intersect but have differing inheritability.  Check for the
+          first case as that is easy to handle. */
+      intersection_type_t intersection_type;
+      svn_boolean_t sorted = FALSE;
+
+      SVN_ERR(get_type_of_intersection(new_range, lastrange,
+                                        &intersection_type));
+
+      switch (intersection_type)
+        {
+          case svn__no_intersection:
+            /* NEW_RANGE and *LASTRANGE *really* don't intersect so
+                just push NEW_RANGE onto RANGELIST. */
+            APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) =
+              svn_merge_range_dup(new_range, result_pool);
+            sorted = (svn_sort_compare_ranges(&lastrange,
+                                              &new_range) < 0);
+            break;
+
+          case svn__equal_intersection:
+            /* They range are equal so all we do is force the
+                inheritability of lastrange to true. */
+            lastrange->inheritable = TRUE;
+            sorted = TRUE;
+            break;
+
+          case svn__adjoining_intersection:
+            /* They adjoin but don't overlap so just push NEW_RANGE
+                onto RANGELIST. */
+            APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) =
+              svn_merge_range_dup(new_range, result_pool);
+            sorted = (svn_sort_compare_ranges(&lastrange,
+                                              &new_range) < 0);
+            break;
+
+          case svn__overlapping_intersection:
+            /* They ranges overlap but neither is a proper subset of
+                the other.  We'll end up pusing two new ranges onto
+                RANGELIST, the intersecting part and the part unique to
+                NEW_RANGE.*/
+            {
+              svn_merge_range_t *r1 = svn_merge_range_dup(lastrange,
+                                                          result_pool);
+              svn_merge_range_t *r2 = svn_merge_range_dup(new_range,
+                                                          result_pool);
+
+              /* Pop off *LASTRANGE to make our manipulations
+                  easier. */
+              apr_array_pop(rangelist);
 
-          SVN_ERR(get_type_of_intersection(new_range, lastrange,
-                                           &intersection_type));
+              /* Ensure R1 is the older range. */
+              if (r2->start < r1->start)
+                {
+                  /* Swap R1 and R2. */
+                  *r2 = *r1;
+                  *r1 = *new_range;
+                }
+
+              /* Absorb the intersecting ranges into the
+                  inheritable range. */
+              if (r1->inheritable)
+                r2->start = r1->end;
+              else
+                r1->end = r2->start;
+
+              /* Push everything back onto RANGELIST. */
+              APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) = r1;
+              sorted = (svn_sort_compare_ranges(&lastrange,
+                                                &r1) < 0);
+              APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) = r2;
+              if (sorted)
+                sorted = (svn_sort_compare_ranges(&r1, &r2) < 0);
+              break;
+            }
 
-          switch (intersection_type)
+          default: /* svn__proper_subset_intersection */
             {
-              case svn__no_intersection:
-                /* NEW_RANGE and *LASTRANGE *really* don't intersect so
-                   just push NEW_RANGE onto RANGELIST. */
-                APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) =
-                  svn_merge_range_dup(new_range, result_pool);
-                sorted = (svn_sort_compare_ranges(&lastrange,
-                                                  &new_range) < 0);
-                break;
-
-              case svn__equal_intersection:
-                /* They range are equal so all we do is force the
-                   inheritability of lastrange to true. */
-                lastrange->inheritable = TRUE;
-                sorted = TRUE;
-                break;
-
-              case svn__adjoining_intersection:
-                /* They adjoin but don't overlap so just push NEW_RANGE
-                   onto RANGELIST. */
-                APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) =
-                  svn_merge_range_dup(new_range, result_pool);
-                sorted = (svn_sort_compare_ranges(&lastrange,
-                                                  &new_range) < 0);
-                break;
-
-              case svn__overlapping_intersection:
-                /* They ranges overlap but neither is a proper subset of
-                   the other.  We'll end up pusing two new ranges onto
-                   RANGELIST, the intersecting part and the part unique to
-                   NEW_RANGE.*/
-                {
-                  svn_merge_range_t *r1 = svn_merge_range_dup(lastrange,
-                                                              result_pool);
-                  svn_merge_range_t *r2 = svn_merge_range_dup(new_range,
-                                                              result_pool);
-
-                  /* Pop off *LASTRANGE to make our manipulations
-                     easier. */
-                  apr_array_pop(rangelist);
+              /* One range is a proper subset of the other. */
+              svn_merge_range_t *r1 = svn_merge_range_dup(lastrange,
+                                                          result_pool);
+              svn_merge_range_t *r2 = svn_merge_range_dup(new_range,
+                                                          result_pool);
+              svn_merge_range_t *r3 = NULL;
+
+              /* Pop off *LASTRANGE to make our manipulations
+                  easier. */
+              apr_array_pop(rangelist);
 
-                  /* Ensure R1 is the older range. */
-                  if (r2->start < r1->start)
-                    {
-                      /* Swap R1 and R2. */
-                      *r2 = *r1;
-                      *r1 = *new_range;
-                    }
+              /* Ensure R1 is the superset. */
+              if (r2->start < r1->start || r2->end > r1->end)
+                {
+                  /* Swap R1 and R2. */
+                  *r2 = *r1;
+                  *r1 = *new_range;
+                }
+
+              if (r1->inheritable)
+                {
+                  /* The simple case: The superset is inheritable, so
+                      just combine r1 and r2. */
+                  r1->start = MIN(r1->start, r2->start);
+                  r1->end = MAX(r1->end, r2->end);
+                  r2 = NULL;
+                }
+              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;
+                  r2->inheritable = r1->inheritable;
+                  r1->inheritable = TRUE;
+                  r2->start = r1->end;
+                  r2->end = tmp_revnum;
+                }
+              else if (r1->end == r2->end)
+                {
+                  /* *LASTRANGE and NEW_RANGE share an end point. */
+                  r1->end = r2->start;
+                  r2->inheritable = TRUE;
+                }
+              else
+                {
+                  /* NEW_RANGE and *LASTRANGE share neither start
+                      nor end points. */
+                  r3 = apr_pcalloc(result_pool, sizeof(*r3));
+                  r3->start = r2->end;
+                  r3->end = r1->end;
+                  r3->inheritable = r1->inheritable;
+                  r2->inheritable = TRUE;
+                  r1->end = r2->start;
+                }
 
-                  /* Absorb the intersecting ranges into the
-                     inheritable range. */
-                  if (r1->inheritable)
-                    r2->start = r1->end;
-                  else
-                    r1->end = r2->start;
-
-                  /* Push everything back onto RANGELIST. */
-                  APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) = r1;
-                  sorted = (svn_sort_compare_ranges(&lastrange,
-                                                    &r1) < 0);
+              /* Push everything back onto RANGELIST. */
+              APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) = r1;
+              sorted = (svn_sort_compare_ranges(&lastrange, &r1) < 0);
+              if (r2)
+                {
                   APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) = r2;
                   if (sorted)
                     sorted = (svn_sort_compare_ranges(&r1, &r2) < 0);
-                  break;
                 }
-
-              default: /* svn__proper_subset_intersection */
+              if (r3)
                 {
-                  /* One range is a proper subset of the other. */
-                  svn_merge_range_t *r1 = svn_merge_range_dup(lastrange,
-                                                              result_pool);
-                  svn_merge_range_t *r2 = svn_merge_range_dup(new_range,
-                                                              result_pool);
-                  svn_merge_range_t *r3 = NULL;
-
-                  /* Pop off *LASTRANGE to make our manipulations
-                     easier. */
-                  apr_array_pop(rangelist);
-
-                  /* Ensure R1 is the superset. */
-                  if (r2->start < r1->start || r2->end > r1->end)
-                    {
-                      /* Swap R1 and R2. */
-                      *r2 = *r1;
-                      *r1 = *new_range;
-                    }
-
-                  if (r1->inheritable)
-                    {
-                      /* The simple case: The superset is inheritable, so
-                         just combine r1 and r2. */
-                      r1->start = MIN(r1->start, r2->start);
-                      r1->end = MAX(r1->end, r2->end);
-                      r2 = NULL;
-                    }
-                  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;
-                      r2->inheritable = r1->inheritable;
-                      r1->inheritable = TRUE;
-                      r2->start = r1->end;
-                      r2->end = tmp_revnum;
-                    }
-                  else if (r1->end == r2->end)
-                    {
-                      /* *LASTRANGE and NEW_RANGE share an end point. */
-                      r1->end = r2->start;
-                      r2->inheritable = TRUE;
-                    }
-                  else
-                    {
-                      /* NEW_RANGE and *LASTRANGE share neither start
-                         nor end points. */
-                      r3 = apr_pcalloc(result_pool, sizeof(*r3));
-                      r3->start = r2->end;
-                      r3->end = r1->end;
-                      r3->inheritable = r1->inheritable;
-                      r2->inheritable = TRUE;
-                      r1->end = r2->start;
-                    }
-
-                  /* Push everything back onto RANGELIST. */
-                  APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) = r1;
-                  sorted = (svn_sort_compare_ranges(&lastrange, &r1) < 0);
-                  if (r2)
-                    {
-                      APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) = r2;
-                      if (sorted)
-                        sorted = (svn_sort_compare_ranges(&r1, &r2) < 0);
-                    }
-                  if (r3)
+                  APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) = r3;
+                  if (sorted)
                     {
-                      APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) = r3;
-                      if (sorted)
-                        {
-                          if (r2)
-                            sorted = (svn_sort_compare_ranges(&r2,
-                                                              &r3) < 0);
-                          else
-                            sorted = (svn_sort_compare_ranges(&r1,
-                                                              &r3) < 0);
-                        }
+                      if (r2)
+                        sorted = (svn_sort_compare_ranges(&r2,
+                                                          &r3) < 0);
+                      else
+                        sorted = (svn_sort_compare_ranges(&r1,
+                                                          &r3) < 0);
                     }
-                  break;
                 }
+              break;
             }
+        }
 
-          /* Some of the above cases might have put *RANGELIST out of
-             order, so re-sort.*/
-          if (!sorted)
-            svn_sort__array(rangelist, svn_sort_compare_ranges);
+      /* Some of the above cases might have put *RANGELIST out of
+          order, so re-sort.*/
+      if (!sorted)
+        svn_sort__array(rangelist, svn_sort_compare_ranges);
     }
 
   return SVN_NO_ERROR;



Mime
View raw message