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

Re: svn commit: r1329609 - in /subversion/trunk/subversion: include/svn_error.h libsvn_fs/fs-loader.c

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Tue, 24 Apr 2012 16:14:46 +0100 (BST)

danielsh_at_apache.org wrote:

> URL: http://svn.apache.org/viewvc?rev=1329609&view=rev
> Log:
> Follow-up to r1329601:
>
> * subversion/include/svn_error.h
>   (SVN_ERR_ASSERT2): New.
>
> * subversion/libsvn_fs/fs-loader.c
>   (svn_fs_commit_txn): Use new macro to not-leak errors upon asserting.
>
> Modified: subversion/trunk/subversion/include/svn_error.h
> ==============================================================================
> +/** Like SVN_ERR_ASSERT(), but append ERR to the returned error chain.
> + *
> + * If EXPR is true, return a malfunction error whose chain includes ERR.
> + * If EXPR is false, do nothing.  (In particular, this does not clear ERR.)

True and false are the wrong way around.

- Julian

> + *
> + * @since New in 1.8.
> + */
> +#ifdef __clang_analyzer__
> +#include <assert.h>
> +/* Just ignore ERR.  If the assert triggers, it'll be our least concern. */
> +#define SVN_ERR_ASSERT2(expr, err)      assert((expr))
> +#else
> +#define SVN_ERR_ASSERT2(expr, err)                                     \
> +  do {                                                                 \
> +    if (!(expr)) {                                                     \
> +      return svn_error_compose_create(                                 \
> +              svn_error__malfunction(TRUE, __FILE__, __LINE__, #expr), \
> +              (err));                                                  \
> +    }                                                                  \
> +  } while (0)
> +#endif
Received on 2012-04-24 17:15:25 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.