You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2012/04/27 08:32:40 UTC
svn commit: r1331242 - in /subversion/trunk/subversion: include/svn_error.h
libsvn_subr/error.c
Author: gstein
Date: Fri Apr 27 06:32:40 2012
New Revision: 1331242
URL: http://svn.apache.org/viewvc?rev=1331242&view=rev
Log:
Fix error tracing to record file/line properly.
When code said:
return svn_error_trace(foo());
It would set the file/line for that location, then call foo() and wrap
any resulting error. However, foo() could potentially set its own
file/line for an inner error. This revision uses a helper function to
reorder execution to: call foo(), then set file/line, then wrap any
resulting error with the trace information.
Prior symptoms were duplicate file/line. They are resolved properly now.
* subversion/include/svn_error.h:
(svn_error__trace): new helper function
(svn_error_trace): rewrite in terms of the new helper
* subversion/libsvn_subr/error.c:
(svn_error__trace): new helper to properly set up file/line
Modified:
subversion/trunk/subversion/include/svn_error.h
subversion/trunk/subversion/libsvn_subr/error.c
Modified: subversion/trunk/subversion/include/svn_error.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_error.h?rev=1331242&r1=1331241&r2=1331242&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_error.h (original)
+++ subversion/trunk/subversion/include/svn_error.h Fri Apr 27 06:32:40 2012
@@ -317,7 +317,10 @@ svn_handle_warning(FILE *stream,
#ifdef SVN_ERR__TRACING
#define SVN_ERR__TRACED "traced call"
-#define svn_error_trace(expr) svn_error_quick_wrap((expr), SVN_ERR__TRACED)
+svn_error_t *
+svn_error__trace(const char *file, long line, svn_error_t *err);
+
+#define svn_error_trace(expr) svn_error__trace(__FILE__, __LINE__, (expr))
#else
#define svn_error_trace(expr) (expr)
#endif
Modified: subversion/trunk/subversion/libsvn_subr/error.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/error.c?rev=1331242&r1=1331241&r2=1331242&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/error.c (original)
+++ subversion/trunk/subversion/libsvn_subr/error.c Fri Apr 27 06:32:40 2012
@@ -218,6 +218,28 @@ svn_error_quick_wrap(svn_error_t *child,
svn_error_t *
+svn_error__trace(const char *file, long line, svn_error_t *err)
+{
+#ifndef SVN_DEBUG
+
+ /* We shouldn't even be here, but whatever. Just return the error as-is. */
+ return err;
+
+#else
+
+ /* Only do the work when an error occurs. */
+ if (err)
+ {
+ svn_error__locate(file, line);
+ return svn_error_quick_wrap(err, SVN_ERR__TRACED);
+ }
+ return SVN_NO_ERROR;
+
+#endif
+}
+
+
+svn_error_t *
svn_error_compose_create(svn_error_t *err1,
svn_error_t *err2)
{
Re: svn commit: r1331242 - in /subversion/trunk/subversion:
include/svn_error.h libsvn_subr/error.c
Posted by Hyrum K Wright <hy...@wandisco.com>.
On Fri, Apr 27, 2012 at 1:32 AM, <gs...@apache.org> wrote:
> Author: gstein
> Date: Fri Apr 27 06:32:40 2012
> New Revision: 1331242
>
> URL: http://svn.apache.org/viewvc?rev=1331242&view=rev
> Log:
> Fix error tracing to record file/line properly.
>
> When code said:
> return svn_error_trace(foo());
>
> It would set the file/line for that location, then call foo() and wrap
> any resulting error. However, foo() could potentially set its own
> file/line for an inner error. This revision uses a helper function to
> reorder execution to: call foo(), then set file/line, then wrap any
> resulting error with the trace information.
>
> Prior symptoms were duplicate file/line. They are resolved properly now.
Yay! This has been one of the rather annoying bits of the error
tracing system, that I've never quite been able to track down. Thanks
for fixing it.
-Hyrum
--
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Re: svn commit: r1331242 - in /subversion/trunk/subversion:
include/svn_error.h libsvn_subr/error.c
Posted by Hyrum K Wright <hy...@wandisco.com>.
On Fri, Apr 27, 2012 at 1:32 AM, <gs...@apache.org> wrote:
> Author: gstein
> Date: Fri Apr 27 06:32:40 2012
> New Revision: 1331242
>
> URL: http://svn.apache.org/viewvc?rev=1331242&view=rev
> Log:
> Fix error tracing to record file/line properly.
>
> When code said:
> return svn_error_trace(foo());
>
> It would set the file/line for that location, then call foo() and wrap
> any resulting error. However, foo() could potentially set its own
> file/line for an inner error. This revision uses a helper function to
> reorder execution to: call foo(), then set file/line, then wrap any
> resulting error with the trace information.
>
> Prior symptoms were duplicate file/line. They are resolved properly now.
Yay! This has been one of the rather annoying bits of the error
tracing system, that I've never quite been able to track down. Thanks
for fixing it.
-Hyrum
--
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/