gnrc_pktbuf_static: unify NULL pointer output for stats
Different platforms evaluate `printf()` for NULL pointers differently, resulting tests checking for a certain output to fail. This unifies that (debug) output for the static packet buffer statistics.
This commit is contained in:
parent
046c10ecce
commit
41708d9f03
@ -275,10 +275,23 @@ static inline void _print_chunk(void *chunk, size_t size, int num)
|
||||
od_hex_dump(chunk, size, OD_WIDTH_DEFAULT);
|
||||
}
|
||||
|
||||
static inline void _print_ptr(_unused_t *ptr)
|
||||
{
|
||||
if (ptr == NULL) {
|
||||
printf("(nil)");
|
||||
}
|
||||
else {
|
||||
printf("%p", (void *)ptr);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void _print_unused(_unused_t *ptr)
|
||||
{
|
||||
printf("~ unused: %p (next: %p, size: %4u) ~\n", (void *)ptr,
|
||||
(void *)ptr->next, ptr->size);
|
||||
printf("~ unused: ");
|
||||
_print_ptr(ptr);
|
||||
printf(" (next: ");
|
||||
_print_ptr(ptr->next);
|
||||
printf(", size: %4u) ~\n", ptr->size);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user