FreeBSD/contrib/subversion/subversion/libsvn_ra_serf/update.c
/* Fold all previously collected data in a single buffer allocated in
   RESULT_POOL and clear all intermediate state */
Fold all previously collected data in a single buffer allocated in
RESULT_POOL and clear all intermediate state
Fold all previously collected data in a single buffer allocated in RESULT_POOL and clear all intermediate state
static const char *
body_allocate_all(body_create_baton_t *body,
                  apr_pool_t *result_pool)
{
  char *buffer = apr_pcalloc(result_pool, body->total_bytes);
  const char *data;
  apr_size_t sz;
  apr_status_t s;
  apr_size_t remaining = body->total_bytes;
  char *next = buffer;
  while (!(s = serf_bucket_read(body->collect_bucket, remaining, &data, &sz)))
    {
      memcpy(next, data, sz);
      remaining -= sz;
      next += sz;
      if (! remaining)
        break;
    }
  if (!SERF_BUCKET_READ_ERROR(s))
    {
      memcpy(next, data, sz);
    }
  serf_bucket_destroy(body->collect_bucket);
  body->collect_bucket = NULL;
  return (s != APR_EOF) ? NULL : buffer;
}
static const char * body_allocate_all ( body_create_baton_t * body , apr_pool_t * result_pool ) { char * buffer = apr_pcalloc ( result_pool , body -> total_bytes ) ; const char * data ; apr_size_t sz ; apr_status_t s ; apr_size_t remaining = body -> total_bytes ; char * next = buffer ; while ( ! ( s = serf_bucket_read ( body -> collect_bucket , remaining , & data , & sz ) ) ) { memcpy ( next , data , sz ) ; remaining -= sz ; next += sz ; if ( ! remaining ) break ; } if ( ! SERF_BUCKET_READ_ERROR ( s ) ) { memcpy ( next , data , sz ) ; } serf_bucket_destroy ( body -> collect_bucket ) ; body -> collect_bucket = NULL ; return ( s != APR_EOF ) ? NULL : buffer ; }
Fold all previously collected data in a single buffer allocated in
RESULT_POOL and clear all intermediate state
Fold all previously collected data in a single buffer allocated in RESULT_POOL and clear all intermediate state