FreeBSD/contrib/subversion/subversion/libsvn_diff/token.c
/*
 * Get all tokens from a datasource.  Return the
 * last item in the (circular) list.
 */
Get all tokens from a datasource.  Return the
last item in the (circular) list.
Get all tokens from a datasource . Return the last item in the ( circular ) list .
svn_error_t *
svn_diff__get_tokens(svn_diff__position_t **position_list,
                     svn_diff__tree_t *tree,
                     void *diff_baton,
                     const svn_diff_fns2_t *vtable,
                     svn_diff_datasource_e datasource,
                     apr_off_t prefix_lines,
                     apr_pool_t *pool)
{
  svn_diff__position_t *start_position;
  svn_diff__position_t *position = NULL;
  svn_diff__position_t **position_ref;
  svn_diff__node_t *node;
  void *token;
  apr_off_t offset;
  apr_uint32_t hash;
  *position_list = NULL;
  position_ref = &start_position;
  offset = prefix_lines;
  hash = 0; 
  while (1)
    {
      SVN_ERR(vtable->datasource_get_next_token(&hash, &token,
                                                diff_baton, datasource));
      if (token == NULL)
        break;
      offset++;
      SVN_ERR(tree_insert_token(&node, tree, diff_baton, vtable, hash, token));
      position = apr_palloc(pool, sizeof(*position));
      position->next = NULL;
      position->token_index = node->index;
      position->offset = offset;
      *position_ref = position;
      position_ref = &position->next;
    }
  *position_ref = start_position;
  SVN_ERR(vtable->datasource_close(diff_baton, datasource));
  *position_list = position;
  return SVN_NO_ERROR;
}
svn_error_t * svn_diff__get_tokens ( svn_diff__position_t * * position_list , svn_diff__tree_t * tree , void * diff_baton , const svn_diff_fns2_t * vtable , svn_diff_datasource_e datasource , apr_off_t prefix_lines , apr_pool_t * pool ) { svn_diff__position_t * start_position ; svn_diff__position_t * position = NULL ; svn_diff__position_t * * position_ref ; svn_diff__node_t * node ; void * token ; apr_off_t offset ; apr_uint32_t hash ; * position_list = NULL ; position_ref = & start_position ; offset = prefix_lines ; hash = 0 ; while ( 1 ) { SVN_ERR ( vtable -> datasource_get_next_token ( & hash , & token , diff_baton , datasource ) ) ; if ( token == NULL ) break ; offset ++ ; SVN_ERR ( tree_insert_token ( & node , tree , diff_baton , vtable , hash , token ) ) ; position = apr_palloc ( pool , sizeof ( * position ) ) ; position -> next = NULL ; position -> token_index = node -> index ; position -> offset = offset ; * position_ref = position ; position_ref = & position -> next ; } * position_ref = start_position ; SVN_ERR ( vtable -> datasource_close ( diff_baton , datasource ) ) ; * position_list = position ; return SVN_NO_ERROR ; }
Get all tokens from a datasource.
Get all tokens from a datasource .
/* The callback fn doesn't need to touch it per se */ /* Create a new position */