|
@@ -988,8 +988,15 @@ static noinline_for_stack
|
|
char *pointer(const char *fmt, char *buf, char *end, void *ptr,
|
|
char *pointer(const char *fmt, char *buf, char *end, void *ptr,
|
|
struct printf_spec spec)
|
|
struct printf_spec spec)
|
|
{
|
|
{
|
|
- if (!ptr)
|
|
|
|
|
|
+ if (!ptr) {
|
|
|
|
+ /*
|
|
|
|
+ * Print (null) with the same width as a pointer so it makes
|
|
|
|
+ * tabular output look nice.
|
|
|
|
+ */
|
|
|
|
+ if (spec.field_width == -1)
|
|
|
|
+ spec.field_width = 2 * sizeof(void *);
|
|
return string(buf, end, "(null)", spec);
|
|
return string(buf, end, "(null)", spec);
|
|
|
|
+ }
|
|
|
|
|
|
switch (*fmt) {
|
|
switch (*fmt) {
|
|
case 'F':
|
|
case 'F':
|
|
@@ -1031,7 +1038,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
|
|
}
|
|
}
|
|
spec.flags |= SMALL;
|
|
spec.flags |= SMALL;
|
|
if (spec.field_width == -1) {
|
|
if (spec.field_width == -1) {
|
|
- spec.field_width = 2*sizeof(void *);
|
|
|
|
|
|
+ spec.field_width = 2 * sizeof(void *);
|
|
spec.flags |= ZEROPAD;
|
|
spec.flags |= ZEROPAD;
|
|
}
|
|
}
|
|
spec.base = 16;
|
|
spec.base = 16;
|