qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH V2 4/5] util: add new function message_printf()


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH V2 4/5] util: add new function message_printf()
Date: Fri, 24 May 2013 13:45:54 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

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 <address@hidden>
> ---
>  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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]