* [PATCH kvm-unit-tests] libcflat: add support for %zd and %td
@ 2017-05-12 15:42 Paolo Bonzini
2017-05-12 15:54 ` Radim Krčmář
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2017-05-12 15:42 UTC (permalink / raw)
To: kvm; +Cc: rkrcmar
These are useful to avoid warnings from the compiler.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
lib/printf.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lib/printf.c b/lib/printf.c
index 063a1ed..a96faee 100644
--- a/lib/printf.c
+++ b/lib/printf.c
@@ -176,6 +176,15 @@ int vsnprintf(char *buf, int size, const char *fmt, va_list va)
case 'l':
++nlong;
goto morefmt;
+ case 't':
+ case 'z':
+ /* Here we only care that sizeof(size_t) == sizeof(long).
+ * On a 32-bit platform it doesn't matter that size_t is
+ * typedef'ed to int or long; va_arg will work either way.
+ * Same for ptrdiff_t (%td).
+ */
+ nlong = 1;
+ goto morefmt;
case 'd':
switch (nlong) {
case 0:
--
2.12.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH kvm-unit-tests] libcflat: add support for %zd and %td
2017-05-12 15:42 [PATCH kvm-unit-tests] libcflat: add support for %zd and %td Paolo Bonzini
@ 2017-05-12 15:54 ` Radim Krčmář
0 siblings, 0 replies; 2+ messages in thread
From: Radim Krčmář @ 2017-05-12 15:54 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm
2017-05-12 17:42+0200, Paolo Bonzini:
> These are useful to avoid warnings from the compiler.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-12 15:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-12 15:42 [PATCH kvm-unit-tests] libcflat: add support for %zd and %td Paolo Bonzini
2017-05-12 15:54 ` Radim Krčmář
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).