diff options
author | Joe Perches <joe@perches.com> | 2010-10-26 17:22:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-26 19:52:16 -0400 |
commit | 5e0579812834ab7fa072db4a15ebdff68d62e2e7 (patch) | |
tree | 5bd1869f615609a3dc47a867d322cb4dbca0ca03 /lib/vsprintf.c | |
parent | 77006a0a828249dd69341f960043ee41e7487aa0 (diff) |
vsprintf.c: use default pointer field size for "(null)" strings
It might be nicer to align the output.
For instance, ACPI messages sometimes have "(null)" pointers.
$ dmesg | grep "(null)" -A 1 -B 1
[ 0.198733] ACPI: Dynamic OEM Table Load:
[ 0.198745] ACPI: SSDT (null) 00239 (v02 PmRef Cpu0Ist 00003000 INTL 20051117)
[ 0.199294] ACPI: SSDT 7f596e10 001C7 (v02 PmRef Cpu0Cst 00003001 INTL 20051117)
[ 0.200708] ACPI: Dynamic OEM Table Load:
[ 0.200721] ACPI: SSDT (null) 001C7 (v02 PmRef Cpu0Cst 00003001 INTL 20051117)
[ 0.201950] ACPI: SSDT 7f597f10 000D0 (v02 PmRef Cpu1Ist 00003000 INTL 20051117)
[ 0.203386] ACPI: Dynamic OEM Table Load:
[ 0.203398] ACPI: SSDT (null) 000D0 (v02 PmRef Cpu1Ist 00003000 INTL 20051117)
[ 0.203871] ACPI: SSDT 7f595f10 00083 (v02 PmRef Cpu1Cst 00003000 INTL 20051117)
[ 0.205301] ACPI: Dynamic OEM Table Load:
[ 0.205315] ACPI: SSDT (null) 00083 (v02 PmRef Cpu1Cst 00003000 INTL 20051117)
[akpm@linux-foundation.org: add code comment]
Signed-off-by: Joe Perches <joe@perches.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r-- | lib/vsprintf.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 7af9d841c43b..8378c136b6e1 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
@@ -988,8 +988,15 @@ static noinline_for_stack | |||
988 | char *pointer(const char *fmt, char *buf, char *end, void *ptr, | 988 | char *pointer(const char *fmt, char *buf, char *end, void *ptr, |
989 | struct printf_spec spec) | 989 | struct printf_spec spec) |
990 | { | 990 | { |
991 | if (!ptr) | 991 | if (!ptr) { |
992 | /* | ||
993 | * Print (null) with the same width as a pointer so it makes | ||
994 | * tabular output look nice. | ||
995 | */ | ||
996 | if (spec.field_width == -1) | ||
997 | spec.field_width = 2 * sizeof(void *); | ||
992 | return string(buf, end, "(null)", spec); | 998 | return string(buf, end, "(null)", spec); |
999 | } | ||
993 | 1000 | ||
994 | switch (*fmt) { | 1001 | switch (*fmt) { |
995 | case 'F': | 1002 | case 'F': |
@@ -1031,7 +1038,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, | |||
1031 | } | 1038 | } |
1032 | spec.flags |= SMALL; | 1039 | spec.flags |= SMALL; |
1033 | if (spec.field_width == -1) { | 1040 | if (spec.field_width == -1) { |
1034 | spec.field_width = 2*sizeof(void *); | 1041 | spec.field_width = 2 * sizeof(void *); |
1035 | spec.flags |= ZEROPAD; | 1042 | spec.flags |= ZEROPAD; |
1036 | } | 1043 | } |
1037 | spec.base = 16; | 1044 | spec.base = 16; |