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

Joe Jin
2025-02-27T18:30:58Z

On 2/27/25 01:25, Karel Zak wrote:
> 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.

I'll remove the macro.

>
>> +#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.

Thanks for your suggestions, I'll create an inline function.

Thanks,
Joe

>
> Karel
>