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. --- lib/dynamic_debug.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 31d3be30776e..20b712652ee4 100644 --- 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 ) static void vpr_info_dq(const struct ddebug_query *query, const char *msg) { /* trim any trailing newlines */ @@ -127,10 +128,10 @@ static void vpr_info_dq(const struct ddebug_query *query, const char *msg) vpr_info("%s: func=\"%s\" file=\"%s\" module=\"%s\" format=\"%.*s\" lineno=%u-%u\n", msg, - query->function ? query->function : "", - query->filename ? query->filename : "", - query->module ? query->module : "", - fmtlen, query->format ? query->format : "", + maybe(query->function, ""), + maybe(query->filename, ""), + maybe(query->module, ""), + fmtlen, maybe(query->format, ""), query->first_lineno, query->last_lineno); } -- 2.26.2