software/libbase/vsnprintf: Prefix pointers by "0x"

Set the PRINTF_SPECIAL flag when printing pointers, so they are prefixed
by "0x", to match glibc behavior.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
This commit is contained in:
Geert Uytterhoeven 2021-01-15 11:31:39 +01:00
parent 91c9192626
commit bff23b8f73

View file

@ -186,7 +186,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
case 'p':
if (field_width == -1) {
field_width = 2*sizeof(void *);
flags |= PRINTF_ZEROPAD;
flags |= PRINTF_ZEROPAD | PRINTF_SPECIAL;
}
str = number(str, end,
(unsigned long) va_arg(args, void *),