From e9d4d55666810dbd9a76d3e48d826cbbc7ac1c84 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Tue, 26 Oct 2010 14:22:50 -0700 Subject: [PATCH] --- yaml --- r: 217548 b: refs/heads/master c: 5e0579812834ab7fa072db4a15ebdff68d62e2e7 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/lib/vsprintf.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 2c7339509c50..ca48b067e639 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 77006a0a828249dd69341f960043ee41e7487aa0 +refs/heads/master: 5e0579812834ab7fa072db4a15ebdff68d62e2e7 diff --git a/trunk/lib/vsprintf.c b/trunk/lib/vsprintf.c index 7af9d841c43b..8378c136b6e1 100644 --- a/trunk/lib/vsprintf.c +++ b/trunk/lib/vsprintf.c @@ -988,8 +988,15 @@ static noinline_for_stack char *pointer(const char *fmt, char *buf, char *end, void *ptr, 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); + } switch (*fmt) { case 'F': @@ -1031,7 +1038,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, } spec.flags |= SMALL; if (spec.field_width == -1) { - spec.field_width = 2*sizeof(void *); + spec.field_width = 2 * sizeof(void *); spec.flags |= ZEROPAD; } spec.base = 16;