You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Garrett Rooney <ro...@electricjellyfish.net> on 2004/04/11 17:20:34 UTC

Re: svn commit: r9321 - trunk/subversion/libsvn_fs_fs

On Apr 11, 2004, at 12:05 PM, jpieper@tigris.org wrote:

> +/* Read a text representation of an apr_hash from STREAM into the hash
> +   object HASH.  Allocations are from POOL.  This is copied directly
> +   from svn_hash_read, with file reads replaced by stream reads. */
> +static svn_error_t *
> +hash_read (apr_hash_t *hash,
> +           svn_stream_t *stream,
> +           apr_pool_t *pool)
> +{
> +  svn_error_t *err;
> +  svn_stringbuf_t *stringbuf;
> +  svn_boolean_t eof;
> +  char buf[SVN_KEYLINE_MAXLEN];
> +  apr_size_t num_read;
> +  char c;
> +  int first_time = 1;
> +
> +
> +  while (1)
> +    {
> +      /* Read a key length line.  Might be END, though. */
> +      apr_size_t len = sizeof (buf);
> +
> +      SVN_ERR (svn_stream_readline (stream, &stringbuf, "\n", &eof, 
> pool));
> +      if (eof)
> +        {
> +          /* We got an EOF on our very first attempt to read, which
> +             means it's a zero-byte file.  No problem, just go home. 
> */
> +          svn_error_clear (err);
> +          return SVN_NO_ERROR;

Any specific reason for clearing the error here?  As far as I can tell 
if svn_stream_readline had returned an error you'd already have exited 
the function, so err is probably uninitialized here...

-garrett


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: r9321 - trunk/subversion/libsvn_fs_fs

Posted by Josh Pieper <jp...@andrew.cmu.edu>.
> >+/* Read a text representation of an apr_hash from STREAM into the hash
> >+   object HASH.  Allocations are from POOL.  This is copied directly
> >+   from svn_hash_read, with file reads replaced by stream reads. */
> >+static svn_error_t *
> >+hash_read (apr_hash_t *hash,
> >+           svn_stream_t *stream,
> >+           apr_pool_t *pool)
> >+{
> >+  svn_error_t *err;
> >+  svn_stringbuf_t *stringbuf;
> >+  svn_boolean_t eof;
> >+  char buf[SVN_KEYLINE_MAXLEN];
> >+  apr_size_t num_read;
> >+  char c;
> >+  int first_time = 1;
> >+
> >+
> >+  while (1)
> >+    {
> >+      /* Read a key length line.  Might be END, though. */
> >+      apr_size_t len = sizeof (buf);
> >+
> >+      SVN_ERR (svn_stream_readline (stream, &stringbuf, "\n", &eof, 
> >pool));
> >+      if (eof)
> >+        {
> >+          /* We got an EOF on our very first attempt to read, which
> >+             means it's a zero-byte file.  No problem, just go home. 
> >*/
> >+          svn_error_clear (err);
> >+          return SVN_NO_ERROR;
> 
> Any specific reason for clearing the error here?  As far as I can tell 
> if svn_stream_readline had returned an error you'd already have exited 
> the function, so err is probably uninitialized here...

Hehe, it turns out that err isn't even used any more.  That was just
sloppiness from copying/modifying.  Thanks for the sharp eye Garrett!

-Josh

-- 
Well begun is half done.
		-- Aristotle

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org