Skip to content

Commit

Permalink
logger: convert: Code quality improvements
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
softwarecki committed Sep 22, 2023
1 parent a1e6420 commit ddc5ae6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tools/logger/convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ struct proc_ldc_entry {
uintptr_t params[TRACE_MAX_PARAMS_COUNT];
};

static const char *BAD_PTR_STR = "<bad uid ptr 0x%.8x>";

#define BAD_PTR_STR "<bad uid ptr 0x%.8x>"
#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"

Expand Down Expand Up @@ -325,7 +324,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.
Expand Down

0 comments on commit ddc5ae6

Please sign in to comment.