diff options
author | Jan Beulich <jbeulich@suse.com> | 2012-09-21 14:25:12 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2012-09-21 14:25:12 +0200 |
commit | 8a858447e93a080c8f46dfd5224f6952122da05f (patch) | |
tree | a9f63a18e565e4d784374274cdd7b0c80fbfbbdb /xen/common/vsprintf.c | |
parent | 724b55f48a6c9fca00ddeeca5a130657680caf0b (diff) | |
download | xen-8a858447e93a080c8f46dfd5224f6952122da05f.tar.gz xen-8a858447e93a080c8f46dfd5224f6952122da05f.tar.bz2 xen-8a858447e93a080c8f46dfd5224f6952122da05f.zip |
printk: prefer %#x et at over 0x%x
Performance is not an issue with printk(), so let the function do
minimally more work and instead save a byte per affected format
specifier.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common/vsprintf.c')
-rw-r--r-- | xen/common/vsprintf.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/xen/common/vsprintf.c b/xen/common/vsprintf.c index 00a6e09f87..a79fef3840 100644 --- a/xen/common/vsprintf.c +++ b/xen/common/vsprintf.c @@ -171,10 +171,14 @@ static char *number( } } if (type & SPECIAL) { - if (base == 16) + if (num == 0) + type &= ~SPECIAL; + else if (base == 16) size -= 2; else if (base == 8) size--; + else + type &= ~SPECIAL; } i = 0; if (num == 0) @@ -197,14 +201,10 @@ static char *number( ++buf; } if (type & SPECIAL) { - if (base==8) { - if (buf <= end) - *buf = '0'; - ++buf; - } else if (base==16) { - if (buf <= end) - *buf = '0'; - ++buf; + if (buf <= end) + *buf = '0'; + ++buf; + if (base == 16) { if (buf <= end) *buf = digits[33]; ++buf; |