From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Keir Fraser <keir@xen.org>, Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 2/7] common/vsprintf: Refactor pointer() out of vsnprintf()
Date: Mon, 4 Nov 2013 21:30:19 +0000 [thread overview]
Message-ID: <1383600624-6345-3-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1383600624-6345-1-git-send-email-andrew.cooper3@citrix.com>
No fuctional change
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
---
xen/common/vsprintf.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/xen/common/vsprintf.c b/xen/common/vsprintf.c
index 1bcbd79..5fdd391 100644
--- a/xen/common/vsprintf.c
+++ b/xen/common/vsprintf.c
@@ -261,6 +261,21 @@ static char *string(char *str, char *end, const char *s,
return str;
}
+static char *pointer(char *str, char *end,
+ unsigned long val, int field_width, int precision,
+ int flags)
+{
+ if ( field_width == -1 )
+ {
+ field_width = 2 * sizeof(void *);
+ flags |= ZEROPAD;
+ }
+
+ str = number(str, end, val, 16, field_width, precision, flags);
+
+ return str;
+}
+
/**
* vsnprintf - Format a string and place it in a buffer
* @buf: The buffer to place the result into
@@ -399,13 +414,8 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
continue;
case 'p':
- if (field_width == -1) {
- field_width = 2*sizeof(void *);
- flags |= ZEROPAD;
- }
- str = number(str, end,
- (unsigned long) va_arg(args, void *),
- 16, field_width, precision, flags);
+ str = pointer(str, end, (unsigned long) va_arg(args, void *),
+ field_width, precision, flags);
continue;
--
1.7.10.4
next prev parent reply other threads:[~2013-11-04 21:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-04 21:30 [PATCH v2 0/7] Printk symbol specifier Andrew Cooper
2013-11-04 21:30 ` [PATCH 1/7] common/vsprintf: Refactor string() out of vsnprintf() Andrew Cooper
2013-11-04 21:30 ` Andrew Cooper [this message]
2013-11-05 10:21 ` [PATCH 2/7] common/vsprintf: Refactor pointer() " Jan Beulich
2013-11-05 10:25 ` Andrew Cooper
2013-11-04 21:30 ` [PATCH 3/7] common/vsprintf: Add %ps and %pS format specifier support Andrew Cooper
2013-11-05 10:39 ` Ian Campbell
2013-11-05 10:43 ` Andrew Cooper
2013-11-05 10:40 ` Jan Beulich
2013-11-05 10:57 ` Andrew Cooper
2013-11-04 21:30 ` [PATCH 4/7] x86: Replace print_symbol() with new %ps/%pS format Andrew Cooper
2013-11-05 10:47 ` Jan Beulich
2013-11-05 10:52 ` Andrew Cooper
2013-11-05 11:14 ` Jan Beulich
2013-11-05 11:16 ` Andrew Cooper
2013-11-04 21:30 ` [PATCH 5/7] arm: " Andrew Cooper
2013-11-04 21:30 ` [PATCH 6/7] common/symbols: Remove print_symbol() and associated infrastructure Andrew Cooper
2013-11-04 21:30 ` [PATCH 7/7] Test harness for new printk formatting Andrew Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1383600624-6345-3-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).