Re: [PATCH 1/3] irqtop: add batch mode support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 26, 2025 at 08:49:14PM GMT, Joe Jin wrote:
> +#define irqtop_batch_mode(ctl) ((ctl)->batch == true)

Do we need this macro? I think use

 if (ctl->batch)
   ...
or

 if (!ctl->batch)
   ...

in the code is good enough.

> +#define irqtop_printf(ctl, fmt, args...)		\
> +	do { 						\
> +		if (irqtop_batch_mode(ctl))		\
> +			fprintf(stdout, fmt, ##args);	\
> +		else {					\
> +			wprintw(ctl->win, fmt, ##args);	\
> +		}					\
> +	}while(0)

It would be more robust to use an inline function with vw_printw() and
vfprintf() rather than a macro with a variadic number of arguments, or
use __VA_ARGS__ in the macro.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com





[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux