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

Re: svn commit: r983807 - in /subversion/branches/atomic-revprop/subversion: include/svn_error.h libsvn_subr/error.c

From: Julian Foad <julian.foad_at_wandisco.com>
Date: Tue, 10 Aug 2010 12:17:24 +0100

On Mon, 2010-08-09, danielsh_at_apache.org wrote:
>
> +/** Return TRUE if @a err's chain contains the error code @a apr_err.
> + *
> + * @since New in 1.7.
> + */
> +svn_boolean_t
> +svn_error_has_cause(svn_error_t *err, apr_status_t apr_err);

This looks like it could be a useful API.

I would expect to be able to call such a function on a NULL error
pointer, and the result should be FALSE since "no error" doesn't have
any cause that can be expressed in an apr_status_t.
 
> +svn_boolean_t
> +svn_error_has_cause(svn_error_t *err, apr_status_t apr_err)
> +{
> + svn_error_t *child;
> +
> + if (! err && ! apr_err)
> + /* The API doesn't specify the behaviour when ERR is NULL. */
> + return TRUE;

What's this block for? The behaviour I mentioned above would fall out
from just removing this block. It looks like this is so that you can
write svn_error_has_cause(err, APR_SUCCESS) and get TRUE if ERR is NULL
or contains APR_SUCCESS anywhere in its chain, but is that really
useful?

- Julian

> + for (child = err; child; child = child->child)
> + if (child->apr_err == apr_err)
> + return TRUE;
> +
> + return FALSE;
> +}
Received on 2010-08-10 13:18:10 CEST

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.