common/vsprintf: Refactor pointer() out of vsnprintf()

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
This commit is contained in:
Andrew Cooper authored and Jan Beulich committed 2013-11-12 11:06:45 +01:00
1 parent 67a3542c5b
commit d41b853cc7
1 file changed
+16 -7
+16 -7
View File
@@ -261,6 +261,20 @@ static char *string(char *str, char *end, const char *s,
return str;
}
static char *pointer(char *str, char *end,
const void *arg, int field_width, int precision,
int flags)
{
if ( field_width == -1 )
{
field_width = 2 * sizeof(void *);
flags |= ZEROPAD;
}
return number(str, end, (unsigned long)arg,
16, field_width, precision, flags);
}
/**
* vsnprintf - Format a string and place it in a buffer
* @buf: The buffer to place the result into
@@ -399,13 +413,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, va_arg(args, const void *),
field_width, precision, flags);
continue;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.