FreeBSD/contrib/subversion/subversion/libsvn_fs_fs/transaction.c
/* An implementation of svn_fs_fs__change_receiver_t.
   Examine all the changed path entries in CHANGES and store them in
   *CHANGED_PATHS.  Folding is done to remove redundant or unnecessary
   data. Do all allocations in POOL. */
An implementation of svn_fs_fs__change_receiver_t.
Examine all the changed path entries in CHANGES and store them in
CHANGED_PATHS.  Folding is done to remove redundant or unnecessary
data. Do all allocations in POOL.
An implementation of svn_fs_fs__change_receiver_t . Examine all the changed path entries in CHANGES and store them in CHANGED_PATHS . Folding is done to remove redundant or unnecessary data . Do all allocations in POOL .
static svn_error_t *
process_changes(void *baton_p,
                change_t *change,
                apr_pool_t *scratch_pool)
{
  process_changes_baton_t *baton = baton_p;
  SVN_ERR(fold_change(baton->changed_paths, baton->deletions, change));
  if ((change->info.change_kind == svn_fs_path_change_delete)
       || (change->info.change_kind == svn_fs_path_change_replace))
    {
      apr_hash_index_t *hi;
      apr_ssize_t path_len = change->path.len;
      apr_ssize_t min_child_len = path_len == 0
                                ? 1
                                : change->path.data[path_len-1] == '/'
                                    ? path_len + 1
                                    : path_len + 2;
      for (hi = apr_hash_first(scratch_pool, baton->changed_paths);
           hi;
           hi = apr_hash_next(hi))
        {
          const void *path;
          apr_ssize_t klen;
          svn_fs_path_change2_t *old_change;
          apr_hash_this(hi, &path, &klen, (void**)&old_change);
          if (klen >= min_child_len)
            {
              const char *child;
              child = svn_fspath__skip_ancestor(change->path.data, path);
              if (child && child[0] != '\0')
                {
                  apr_hash_set(baton->changed_paths, path, klen, NULL);
                }
            }
        }
    }
  return SVN_NO_ERROR;
}
static svn_error_t * process_changes ( void * baton_p , change_t * change , apr_pool_t * scratch_pool ) { process_changes_baton_t * baton = baton_p ; SVN_ERR ( fold_change ( baton -> changed_paths , baton -> deletions , change ) ) ; if ( ( change -> info . change_kind == svn_fs_path_change_delete ) || ( change -> info . change_kind == svn_fs_path_change_replace ) ) { apr_hash_index_t * hi ; apr_ssize_t path_len = change -> path . len ; apr_ssize_t min_child_len = path_len == 0 ? 1 : change -> path . data [ path_len - 1 ] == ' ' ? path_len + 1 : path_len + 2 ; for ( hi = apr_hash_first ( scratch_pool , baton -> changed_paths ) ; hi ; hi = apr_hash_next ( hi ) ) { const void * path ; apr_ssize_t klen ; svn_fs_path_change2_t * old_change ; apr_hash_this ( hi , & path , & klen , ( void * * ) & old_change ) ; if ( klen >= min_child_len ) { const char * child ; child = svn_fspath__skip_ancestor ( change -> path . data , path ) ; if ( child && child [ 0 ] != ' \0 ' ) { apr_hash_set ( baton -> changed_paths , path , klen , NULL ) ; } } } } return SVN_NO_ERROR ; }
An implementation of svn_fs_fs__change_receiver_t.
An implementation of svn_fs_fs__change_receiver_t .
/* Now, if our change was a deletion or replacement, we have to
     blow away any changes thus far on paths that are (or, were)
     children of this path.
     ### i won't bother with another iteration pool here -- at
     most we talking about a few extra dups of paths into what
     is already a temporary subpool.
  */ /* a potential child path must contain at least 2 more chars
         (the path separator plus at least one char for the name).
         Also, we should not assume that all paths have been normalized
         i.e. some might have trailing path separators.
      */ /* CAUTION: This is the inner loop of an O(n^2) algorithm.
         The number of changes to process may be >> 1000.
         Therefore, keep the inner loop as tight as possible.
      */ /* KEY is the path. */ /* If we come across a child of our path, remove it.
             Call svn_fspath__skip_ancestor only if there is a chance that
             this is actually a sub-path.
           */