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