FreeBSD/contrib/subversion/subversion/libsvn_subr/checksum.c
/* Common constructor function for svn_checksum__wrap_write_stream and
 * svn_checksum__wrap_write_stream_fnv1a_32x4, taking the superset of their
 * respecting parameters.
 *
 * In the current usage, either CHECKSUM or DIGEST will be NULL but this
 * function does not enforce any such restriction.  Also, the caller must
 * make sure that DIGEST refers to a buffer of sufficient length.
 */
Common constructor function for svn_checksum__wrap_write_stream and
svn_checksum__wrap_write_stream_fnv1a_32x4, taking the superset of their
respecting parameters.

In the current usage, either CHECKSUM or DIGEST will be NULL but this
function does not enforce any such restriction.  Also, the caller must
make sure that DIGEST refers to a buffer of sufficient length.
Common constructor function for svn_checksum__wrap_write_stream and svn_checksum__wrap_write_stream_fnv1a_32x4 taking the superset of their respecting parameters . In the current usage either CHECKSUM or DIGEST will be NULL but this function does not enforce any such restriction . Also the caller must make sure that DIGEST refers to a buffer of sufficient length .
static svn_stream_t *
wrap_write_stream(svn_checksum_t **checksum,
                  unsigned char *digest,
                  svn_stream_t *inner_stream,
                  svn_checksum_kind_t kind,
                  apr_pool_t *pool)
{
  svn_stream_t *outer_stream;
  stream_baton_t *baton = apr_pcalloc(pool, sizeof(*baton));
  baton->inner_stream = inner_stream;
  baton->context = svn_checksum_ctx_create(kind, pool);
  baton->checksum = checksum;
  baton->digest = digest;
  baton->pool = pool;
  outer_stream = svn_stream_create(baton, pool);
  svn_stream_set_write(outer_stream, write_handler);
  svn_stream_set_close(outer_stream, close_handler);
  return outer_stream;
}
static svn_stream_t * wrap_write_stream ( svn_checksum_t * * checksum , unsigned char * digest , svn_stream_t * inner_stream , svn_checksum_kind_t kind , apr_pool_t * pool ) { svn_stream_t * outer_stream ; stream_baton_t * baton = apr_pcalloc ( pool , sizeof ( * baton ) ) ; baton -> inner_stream = inner_stream ; baton -> context = svn_checksum_ctx_create ( kind , pool ) ; baton -> checksum = checksum ; baton -> digest = digest ; baton -> pool = pool ; outer_stream = svn_stream_create ( baton , pool ) ; svn_stream_set_write ( outer_stream , write_handler ) ; svn_stream_set_close ( outer_stream , close_handler ) ; return outer_stream ; }
Common constructor function for svn_checksum__wrap_write_stream and
 svn_checksum__wrap_write_stream_fnv1a_32x4, taking the superset of their
 respecting parameters.
Common constructor function for svn_checksum__wrap_write_stream and svn_checksum__wrap_write_stream_fnv1a_32x4 taking the superset of their respecting parameters .