[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: rev 1918 - trunk/subversion/libsvn_repos

From: Greg Stein <gstein_at_lyra.org>
Date: 2002-05-10 00:15:44 CEST

On Thu, May 09, 2002 at 04:55:10PM -0500, sussman@tigris.org wrote:
>...
> @@ -231,31 +234,29 @@
> remaining_bytes = content_length - bytes_sucked;
> if (remaining_bytes > 0)
> {
> + apr_size_t rlen, wlen, i, iterations, remainder;
>...
> + remainder = remaining_bytes % buflen;
> + iterations = remaining_bytes / buflen;

The logic in the function would be a lot simpler if you did a couple things:

* tossed bytes_sucked and just decrement content_length
* toss remaining_bytes and just test content_length directly
* don't compute iterations and remainder: just loop, decrement
  content_length for each chunk you read, and exit when content_length
  reaches zero.

>...
> @@ -326,6 +330,8 @@
> {
> svn_stringbuf_t *linebuf;
> void *current_rev_baton = NULL;
> + char *buffer = apr_pcalloc (pool, SVN_STREAM_CHUNK_SIZE);
> + apr_size_t buflen = SVN_STREAM_CHUNK_SIZE;

Ah! Goodness. Although, I'd suggest tossing buflen, and just passing
SVN_STREAM_CHUNK_SIZE (not too fussed either way, but if you keep the
variable, then init it first and use the var in the alloc). That should also
be apr_palloc() since you don't need it zeroed.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri May 10 00:14:19 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.