lkml.org 
[lkml]   [2020]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 09/24] dyndbg: add maybe(str,"") macro to reduce code
From
Date
On Sat, 2020-06-13 at 09:57 -0600, Jim Cromie wrote:
> reduce word count via macro, no actual object change.
>
> OTOH, maybe() could be scrubbed if printk's default printing (iirc) of
> "(null)" pointers is deemed appropriate for the log-msg.
[]
> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
[]
> @@ -114,6 +114,7 @@ do { \
> #define vpr_info(fmt, ...) vnpr_info(1, fmt, ##__VA_ARGS__)
> #define v2pr_info(fmt, ...) vnpr_info(2, fmt, ##__VA_ARGS__)
>
> +#define maybe(str, empty) ( str ? str : empty )

This macro is unnecessary.

An even shorter very commonly used gcc extension would be

str ?: empty


\
 
 \ /
  Last update: 2020-06-13 18:14    [W:0.335 / U:0.616 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site