FreeBSD/contrib/subversion/subversion/libsvn_fs_x/cached_data.c
/* Create a rep_read_baton structure for node revision NODEREV in
   filesystem FS and store it in *RB_P.  If FULLTEXT_CACHE_KEY is not
   NULL, it is the rep's key in the fulltext cache, and a stringbuf
   must be allocated to store the text.  If rep is mutable, it must be
   refer to file contents.

   Allocate the result in RESULT_POOL.  This includes the pools within *RB_P.
 */
Create a rep_read_baton structure for node revision NODEREV in
filesystem FS and store it in *RB_P.  If FULLTEXT_CACHE_KEY is not
NULL, it is the rep's key in the fulltext cache, and a stringbuf
must be allocated to store the text.  If rep is mutable, it must be
refer to file contents.

Allocate the result in RESULT_POOL.  This includes the pools within *RB_P.
Create a rep_read_baton structure for node revision NODEREV in filesystem FS and store it in * RB_P . If FULLTEXT_CACHE_KEY is not NULL it is the rep ' s key in the fulltext cache and a stringbuf must be allocated to store the text . If rep is mutable it must be refer to file contents . Allocate the result in RESULT_POOL . This includes the pools within * RB_P .
static svn_error_t *
rep_read_get_baton(rep_read_baton_t **rb_p,
                   svn_fs_t *fs,
                   svn_fs_x__representation_t *rep,
                   svn_fs_x__pair_cache_key_t fulltext_cache_key,
                   apr_pool_t *result_pool)
{
  rep_read_baton_t *b;
  b = apr_pcalloc(result_pool, sizeof(*b));
  b->fs = fs;
  b->rep = *rep;
  b->base_window = NULL;
  b->chunk_index = 0;
  b->buf = NULL;
  b->md5_checksum_ctx = svn_checksum_ctx_create(svn_checksum_md5,
                                                result_pool);
  b->checksum_finalized = FALSE;
  memcpy(b->md5_digest, rep->md5_digest, sizeof(rep->md5_digest));
  b->len = rep->expanded_size;
  b->off = 0;
  b->fulltext_cache_key = fulltext_cache_key;
  b->scratch_pool = svn_pool_create(result_pool);
  b->filehandle_pool = svn_pool_create(result_pool);
  b->fulltext_cache = NULL;
  b->fulltext_delivered = 0;
  b->current_fulltext = NULL;
  *rb_p = b;
  return SVN_NO_ERROR;
}
static svn_error_t * rep_read_get_baton ( rep_read_baton_t * * rb_p , svn_fs_t * fs , svn_fs_x__representation_t * rep , svn_fs_x__pair_cache_key_t fulltext_cache_key , apr_pool_t * result_pool ) { rep_read_baton_t * b ; b = apr_pcalloc ( result_pool , sizeof ( * b ) ) ; b -> fs = fs ; b -> rep = * rep ; b -> base_window = NULL ; b -> chunk_index = 0 ; b -> buf = NULL ; b -> md5_checksum_ctx = svn_checksum_ctx_create ( svn_checksum_md5 , result_pool ) ; b -> checksum_finalized = FALSE ; memcpy ( b -> md5_digest , rep -> md5_digest , sizeof ( rep -> md5_digest ) ) ; b -> len = rep -> expanded_size ; b -> off = 0 ; b -> fulltext_cache_key = fulltext_cache_key ; b -> scratch_pool = svn_pool_create ( result_pool ) ; b -> filehandle_pool = svn_pool_create ( result_pool ) ; b -> fulltext_cache = NULL ; b -> fulltext_delivered = 0 ; b -> current_fulltext = NULL ; * rb_p = b ; return SVN_NO_ERROR ; }
Create a rep_read_baton structure for node revision NODEREV in
filesystem FS and store it in *RB_P.
Create a rep_read_baton structure for node revision NODEREV in filesystem FS and store it in * RB_P .
/* Clearable sub-pools.  Since they have to remain valid for as long as B
     lives, we can't take them from some scratch pool.  The caller of this
     function will have no control over how those subpools will be used. */ /* Save our output baton. */