From c45e586eb56d62dcfb475755f102d817cf4fc978 Mon Sep 17 00:00:00 2001 From: Adrian Warecki Date: Mon, 18 Sep 2023 15:37:12 +0200 Subject: [PATCH] logger: convert: Code quality improvements The precision check condition has been simplified, the unsigned value cannot be negative. Added definitions containing an error message instead of using a constant variable. Signed-off-by: Adrian Warecki --- tools/logger/convert.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/logger/convert.c b/tools/logger/convert.c index 4c209ab04701..2e23f061c156 100644 --- a/tools/logger/convert.c +++ b/tools/logger/convert.c @@ -60,8 +60,7 @@ struct proc_ldc_entry { uintptr_t params[TRACE_MAX_PARAMS_COUNT]; }; -static const char *BAD_PTR_STR = ""; - +#define BAD_PTR_STR "" #define UUID_LOWER "%s%s%s<%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x>%s%s%s" #define UUID_UPPER "%s%s%s<%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X>%s%s%s" @@ -313,7 +312,7 @@ static unsigned int timestamp_width(unsigned int precision) * gcc 9.3, this avoids a very long precision causing snprintf() * to truncate time_fmt */ - assert(precision >= 0 && precision < 20); + assert(precision < 20); /* * 12 digits for units is enough for 1M seconds = 11 days which * should be enough for most test runs.