On Thu, May 23, 2013 at 04:47:15PM +0800, Wenchao Xia wrote: > This function takes an input parameter *output, which can be specified by > caller as stderr, stdout or a monitor. error_vprintf() now calls > message_vprintf(), > which is a static function added in this patch. > > Signed-off-by: Wenchao Xia <xiaw...@linux.vnet.ibm.com> > --- > include/qemu/error-report.h | 13 +++++++++++++ > util/qemu-error.c | 28 ++++++++++++++++++++++++++-- > 2 files changed, 39 insertions(+), 2 deletions(-) > > diff --git a/include/qemu/error-report.h b/include/qemu/error-report.h > index c902cc1..cdde78b 100644 > --- a/include/qemu/error-report.h > +++ b/include/qemu/error-report.h > @@ -14,6 +14,8 @@ > #define QEMU_ERROR_H > > #include <stdarg.h> > +#include <stdio.h> > +#include "qemu/typedefs.h" > > typedef struct Location { > /* all members are private to qemu-error.c */ > @@ -32,6 +34,17 @@ void loc_set_none(void); > void loc_set_cmdline(char **argv, int idx, int cnt); > void loc_set_file(const char *fname, int lno); > > +typedef struct QemuOutput { > + enum { OUTPUT_STREAM, OUTPUT_MONITOR } kind; > + union { > + FILE *stream; > + Monitor *monitor; > + }; > +} QemuOutput; > + > +void message_printf(const QemuOutput *output, const char *fmt, ...) > + GCC_FMT_ATTR(2, 3);
This is introducing a slightly different solution for fprintf_function, which is already widely used: $ git grep fprintf_function | wc -l 101 Please reuse fprintf_function. Stefan