Dnia 2009-05-09 o 22:31:13 Hyrum K. Wright napisał(a):
> On May 9, 2009, at 2:16 PM, C. Michael Pilato wrote:
>
> > Author: cmpilato
> > Date: Sat May 9 12:16:40 2009
> > New Revision: 37662
> >
> > Log:
> > Add a new public API for trimming out the trace-only error chain
> > links,
> > and use it in mod_dav_svn to avoid sending useless error messages
> > across
> > the wire. This makes still more tests pass over WebDAV.
> >
> > * subversion/include/svn_error.h
> > (svn_err_purge_tracing): New function prototype.
> >
> > * subversion/libsvn_subr/error.c
> > (is_tracing_link): New function, taking the place of ...
> > (is_trace_message): ... this now-removed one. Callers updated to call
> > is_tracing_link() instead.
> > (svn_err_purge_tracing): New function.
> >
> > * subversion/mod_dav_svn/version.c
> > (merge): Use svn_err_purge_tracing() before squirreling away the
> > post-commit hook error message.
> >
> > * subversion/mod_dav_svn/util.c
> > (build_error_chain): Revert changes made in r37649.
> > (dav_svn__convert_err): Use svn_err_purge_tracing() before operating
> > on the Subversion error.
> >
> > Modified:
> > trunk/subversion/include/svn_error.h
> > trunk/subversion/libsvn_subr/error.c
> > trunk/subversion/mod_dav_svn/util.c
> > trunk/subversion/mod_dav_svn/version.c
> ...
> > Modified: trunk/subversion/libsvn_subr/error.c
> > URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_subr/error.c?pathrev=37662&r1=37661&r2=37662
> > =
> > =
> > =
> > =
> > =
> > =
> > =
> > =
> > ======================================================================
> > --- trunk/subversion/libsvn_subr/error.c Sat May 9 12:06:18 2009
> > (r37661)
> > +++ trunk/subversion/libsvn_subr/error.c Sat May 9 12:16:40 2009
> > (r37662)
> > @@ -311,16 +311,63 @@ svn_error_clear(svn_error_t *err)
> > }
> > }
> >
> > -/* Is MESSAGE the message used for the "fake" errors used in
> > tracing? */
> > -static svn_boolean_t is_trace_message(const char *message)
> > +/* Is ERR a tracing-only error chain link? */
> > +static svn_boolean_t is_tracing_link(svn_error_t *err)
> > {
> > #ifdef SVN_ERR__TRACING
> > - return (message != NULL && !strcmp(message, SVN_ERR__TRACED));
> > + /* ### A strcmp()? Really? I think it's the best we can do unless
> > + ### we add a boolean field to svn_error_t that's set only for
> > + ### these "placeholder error chain" items. Not such a bad idea,
> > + ### really... */
> > + return (err && err->message && !strcmp(err->message,
> > SVN_ERR__TRACED));
> > #else
> > return FALSE;
> > #endif
> > }
> >
> > +svn_error_t *
> > +svn_err_purge_tracing(svn_error_t *err)
> > +{
> > +#ifdef SVN_ERR__TRACING
> > + svn_error_t *tmp_err = err;
> > + svn_error_t *new_err = NULL, *new_err_leaf = NULL;
> > +
> > + if (! err)
> > + return SVN_NO_ERROR;
> > +
> > + while (tmp_err)
> > + {
> > + /* Skip over any trace-only links. */
> > + while (tmp_err && is_tracing_link(tmp_err))
> > + tmp_err = tmp_err->child;
> > +
> > + /* Add a new link to the new chain (creating the chain if
> > necessary). */
> > + if (! new_err)
> > + {
> > + new_err = tmp_err;
> > + new_err_leaf = new_err;
> > + }
> > + else
> > + {
> > + new_err_leaf->child = tmp_err;
> > + new_err_leaf = new_err_leaf->child;
> > + }
> > +
> > + /* Advance to the next link in the original chain. */
> > + tmp_err = tmp_err->child;
> > + }
> > +
> > + /* If we get here, there had better be a real link in this error
> > chain. */
> > + assert(new_err_leaf);
>
> Perhaps use SVN_ERR_ASSERT()?
FYI, this call to assert() even breaks compilation on systems with non-ancient compiler:
subversion/libsvn_subr/error.c: In function ‘svn_err_purge_tracing’:
subversion/libsvn_subr/error.c:361: error: implicit declaration of function ‘assert’
subversion/libsvn_subr/error.c:361: warning: nested extern declaration of ‘assert’
subversion/libsvn_subr/error.c: In function ‘svn_error_abort_on_malfunction’:
subversion/libsvn_subr/error.c:595: warning: will never be executed
http://crest.ics.uci.edu/buildbot/builders/x64-ubuntu%20gcc/builds/553/steps/Build/logs/stdio/text
--
Arfrever Frehtes Taifersar Arahesis
Received on 2009-05-10 04:32:37 CEST