On Thu, May 10, 2012 at 02:25:25PM +1000, Peter Hutterer wrote:
> Helper functions to avoid things like
> 
> if (foo) {
>     BUG_WARN(foo);
>     return 1;
> }
 
urgh, nevermind about this patch, it's bogus.

Cheers,
  Peter

> ---
>  include/misc.h |    9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/include/misc.h b/include/misc.h
> index 41c1333..a57efa0 100644
> --- a/include/misc.h
> +++ b/include/misc.h
> @@ -380,5 +380,14 @@ extern _X_EXPORT unsigned long serverGeneration;
>            __BUG_WARN_MSG(cond, 1, __VA_ARGS__)
>  
>  #define BUG_WARN(cond)  __BUG_WARN_MSG(cond, 0, NULL)
> +#define BUG_RETURN(cond) \
> +        do { __BUG_WARN_MSG(cond, 0, NULL); return; } while(0)
> +#define BUG_RETURN_MSG(cond, ...) \
> +        do { __BUG_WARN_MSG(cond, 1, __VA_ARGS__); return; } while(0)
>  
> +#define BUG_RETURN_VAL(cond, val) \
> +        do { __BUG_WARN_MSG(cond, 0, NULL); return (val); } while(0)
> +
> +#define BUG_RETURN_VAL_MSG(cond, val, ...) \
> +        do { __BUG_WARN_MSG(cond, 1, __VA_ARGS__); return (val); } while(0)
>  #endif                          /* MISC_H */
> -- 
> 1.7.10.1
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to