subversion/libsvn_client/blame.c
/* Ensure that CHAIN_ORIG and CHAIN_MERGED have the same number of chunks,
   and that for every chunk C, CHAIN_ORIG[C] and CHAIN_MERGED[C] have the
   same starting value.  Both CHAIN_ORIG and CHAIN_MERGED should not be
   NULL.  */
Ensure that CHAIN_ORIG and CHAIN_MERGED have the same number of chunks,
and that for every chunk C, CHAIN_ORIG[C] and CHAIN_MERGED[C] have the
same starting value.  Both CHAIN_ORIG and CHAIN_MERGED should not be
NULL.
Ensure that CHAIN_ORIG and CHAIN_MERGED have the same number of chunks and that for every chunk C CHAIN_ORIG [ C ] and CHAIN_MERGED [ C ] have the same starting value . Both CHAIN_ORIG and CHAIN_MERGED should not be NULL .
static void
normalize_blames(struct blame_chain *chain,
                 struct blame_chain *chain_merged,
                 apr_pool_t *pool)
{
  struct blame *walk, *walk_merged;
  for (walk = chain->blame, walk_merged = chain_merged->blame;
       walk->next && walk_merged->next;
       walk = walk->next, walk_merged = walk_merged->next)
    {
      assert(walk->start == walk_merged->start);
      if (walk->next->start < walk_merged->next->start)
        {
          struct blame *tmp = blame_create(chain_merged, walk_merged->rev,
                                           walk->next->start);
          tmp->next = walk_merged->next;
          walk_merged->next = tmp;
        }
      if (walk->next->start > walk_merged->next->start)
        {
          struct blame *tmp = blame_create(chain, walk->rev,
                                           walk_merged->next->start);
          tmp->next = walk->next;
          walk->next = tmp;
        }
    }
  while (walk->next != NULL)
    {
      struct blame *tmp = blame_create(chain_merged, walk_merged->rev,
                                       walk->next->start);
      walk_merged->next = tmp;
      walk_merged = walk_merged->next;
      walk = walk->next;
    }
  while (walk_merged->next != NULL)
    {
      struct blame *tmp = blame_create(chain, walk->rev,
                                       walk_merged->next->start);
      walk->next = tmp;
      walk = walk->next;
      walk_merged = walk_merged->next;
    }
}
static void normalize_blames ( struct blame_chain * chain , struct blame_chain * chain_merged , apr_pool_t * pool ) { struct blame * walk , * walk_merged ; for ( walk = chain -> blame , walk_merged = chain_merged -> blame ; walk -> next && walk_merged -> next ; walk = walk -> next , walk_merged = walk_merged -> next ) { assert ( walk -> start == walk_merged -> start ) ; if ( walk -> next -> start < walk_merged -> next -> start ) { struct blame * tmp = blame_create ( chain_merged , walk_merged -> rev , walk -> next -> start ) ; tmp -> next = walk_merged -> next ; walk_merged -> next = tmp ; } if ( walk -> next -> start > walk_merged -> next -> start ) { struct blame * tmp = blame_create ( chain , walk -> rev , walk_merged -> next -> start ) ; tmp -> next = walk -> next ; walk -> next = tmp ; } } while ( walk -> next != NULL ) { struct blame * tmp = blame_create ( chain_merged , walk_merged -> rev , walk -> next -> start ) ; walk_merged -> next = tmp ; walk_merged = walk_merged -> next ; walk = walk -> next ; } while ( walk_merged -> next != NULL ) { struct blame * tmp = blame_create ( chain , walk -> rev , walk_merged -> next -> start ) ; walk -> next = tmp ; walk = walk -> next ; walk_merged = walk_merged -> next ; } }
Ensure that CHAIN_ORIG and CHAIN_MERGED have the same number of chunks,
and that for every chunk C, CHAIN_ORIG[C] and CHAIN_MERGED[C] have the
same starting value.
Ensure that CHAIN_ORIG and CHAIN_MERGED have the same number of chunks and that for every chunk C CHAIN_ORIG [ C ] and CHAIN_MERGED [ C ] have the same starting value .
/* Walk over the CHAIN's blame chunks and CHAIN_MERGED's blame chunks,
     creating new chunks as needed. */ /* The current chunks should always be starting at the same offset. */ /* insert a new chunk in CHAIN_MERGED. */ /* insert a new chunk in CHAIN. */ /* If both NEXT pointers are null, the lists are equally long, otherwise
     we need to extend one of them.  If CHAIN is longer, append new chunks
     to CHAIN_MERGED until its length matches that of CHAIN. */ /* Same as above, only extend CHAIN to match CHAIN_MERGED. */