You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/09/09 13:31:13 UTC

svn commit: r995383 - /subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Author: stsp
Date: Thu Sep  9 11:31:12 2010
New Revision: 995383

URL: http://svn.apache.org/viewvc?rev=995383&view=rev
Log:
* subversion/libsvn_fs_fs/fs_fs.c
  (read_rep_line): Properly indent the body of various if-statements.
   Use "error" instead of "err" as a goto label, because "err" is the
   conventional name for variables of type svn_error_t*.
   Use svn_error_return() when returning errors.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=995383&r1=995382&r2=995383&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Thu Sep  9 11:31:12 2010
@@ -2528,26 +2528,31 @@ read_rep_line(struct rep_args **rep_args
 
   /* We have hopefully a DELTA vs. a non-empty base revision. */
   str = apr_strtok(buffer, " ", &last_str);
-  if (! str || (strcmp(str, REP_DELTA) != 0)) goto err;
+  if (! str || (strcmp(str, REP_DELTA) != 0))
+    goto error;
 
   str = apr_strtok(NULL, " ", &last_str);
-  if (! str) goto err;
+  if (! str)
+    goto error;
   rep_args->base_revision = SVN_STR_TO_REV(str);
 
   str = apr_strtok(NULL, " ", &last_str);
-  if (! str) goto err;
+  if (! str)
+    goto error;
   rep_args->base_offset = (apr_off_t) apr_atoi64(str);
 
   str = apr_strtok(NULL, " ", &last_str);
-  if (! str) goto err;
+  if (! str)
+    goto error;
   rep_args->base_length = (apr_size_t) apr_atoi64(str);
 
   *rep_args_p = rep_args;
   return SVN_NO_ERROR;
 
- err:
-  return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
-                          _("Malformed representation header"));
+ error:
+  return svn_error_return(
+           svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
+                            _("Malformed representation header")));
 }
 
 /* Given a revision file REV_FILE, opened to REV in FS, find the Node-ID



Re: svn commit: r995383 - /subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Posted by Stefan Sperling <st...@elego.de>.
On Thu, Sep 09, 2010 at 03:39:04PM +0300, Daniel Shahaf wrote:
> It might be good to make the rule "'return svn_error_*();' never needs
> svn_error_return() wrapper" and fix the svn_error_* functions/macros
> that don't already record the file/line.

+1

Re: svn commit: r995383 - /subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Stefan Sperling wrote on Thu, Sep 09, 2010 at 14:27:23 +0200:
> On Thu, Sep 09, 2010 at 03:20:17PM +0300, Daniel Shahaf wrote:
> > stsp@apache.org wrote on Thu, Sep 09, 2010 at 11:31:13 -0000:
> > > +  return svn_error_return(
> > > +           svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
> > > +                            _("Malformed representation header")));
> > 
> > svn_error_return() isn't necessary here, since svn_error_create()
> > has always recorded the file-line coordinates.
> > 
> > That's unlike, say, svn_error_compose_create(), which doesn't record the
> > file-line coordinates; thus,
> > 
> >     err1 = foo();
> >     err2 = bar();
> >     return svn_error_return(svn_error_compose_create(err1, err2));
> > 
> > isn't redundant.
> 
> Ah. Is the rule documented somewhere?

Not that I know.  (I (past tense)read svn_error.h.)

It might be good to make the rule "'return svn_error_*();' never needs
svn_error_return() wrapper" and fix the svn_error_* functions/macros
that don't already record the file/line.

Re: svn commit: r995383 - /subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Posted by Stefan Sperling <st...@elego.de>.
On Thu, Sep 09, 2010 at 03:20:17PM +0300, Daniel Shahaf wrote:
> stsp@apache.org wrote on Thu, Sep 09, 2010 at 11:31:13 -0000:
> > +  return svn_error_return(
> > +           svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
> > +                            _("Malformed representation header")));
> 
> svn_error_return() isn't necessary here, since svn_error_create()
> has always recorded the file-line coordinates.
> 
> That's unlike, say, svn_error_compose_create(), which doesn't record the
> file-line coordinates; thus,
> 
>     err1 = foo();
>     err2 = bar();
>     return svn_error_return(svn_error_compose_create(err1, err2));
> 
> isn't redundant.

Ah. Is the rule documented somewhere?

Re: svn commit: r995383 - /subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
stsp@apache.org wrote on Thu, Sep 09, 2010 at 11:31:13 -0000:
> +  return svn_error_return(
> +           svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
> +                            _("Malformed representation header")));

svn_error_return() isn't necessary here, since svn_error_create()
has always recorded the file-line coordinates.

That's unlike, say, svn_error_compose_create(), which doesn't record the
file-line coordinates; thus,

    err1 = foo();
    err2 = bar();
    return svn_error_return(svn_error_compose_create(err1, err2));

isn't redundant.