[OpenWrt-Devel] [PATCH v2 16/16] uci_internal: use comma expression for UCI_INTERNAL() call.

Felix Fietkau nbd at openwrt.org
Thu Dec 18 06:08:03 EST 2014


On 2014-12-16 08:00, Yousong Zhou wrote:
> Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
> ---
>  uci_internal.h |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/uci_internal.h b/uci_internal.h
> index 89863f1..cb8f86c 100644
> --- a/uci_internal.h
> +++ b/uci_internal.h
> @@ -227,10 +227,10 @@ struct uci_backend _var = {		\
>   * Sets Exception handling to passthrough mode.
>   * Allows API functions to change behavior compared to public use
>   */
> -#define UCI_INTERNAL(func, ctx, ...) do { \
> -	ctx->internal = true;		\
> -	func(ctx, __VA_ARGS__);		\
> -} while (0)
> +#define UCI_INTERNAL(func, ctx, ...) (	\
> +	ctx->internal = true,		\
> +	func(ctx, __VA_ARGS__)		\
> +)
A patch like this should have a description that explains why the change
was made. If I had to guess, I'd say you intend to make it possible to
use the return code of UCI_INTERNAL(...).
The standard way to do that is to write it as
({ ctx->internal = true; func(...); })

- Felix
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list