[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 1/8] qemu-error: introduce error_report_nolf
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v2 1/8] qemu-error: introduce error_report_nolf |
Date: |
Thu, 13 Jul 2017 14:32:06 +0100 |
User-agent: |
Mutt/1.8.0 (2017-02-23) |
On Thu, Jul 13, 2017 at 01:02:30PM +0200, Ladi Prosek wrote:
> +/*
> + * Print an error message to current monitor if we have one, else to stderr.
> + * Format arguments like sprintf(). The resulting message should be a
> + * single phrase, with no trailing punctuation. The no-LF version allows
> + * additional text to be appended with error_printf() or error_vprintf().
> + * Make sure to always close with a newline after all text is printed.
> + * Prepends the current location.
> + * It's wrong to call this in a QMP monitor. Use error_setg() there.
> + */
> +void error_report_nolf(const char *fmt, ...)
> +{
> + va_list ap;
> +
> + va_start(ap, fmt);
> + error_vreport_nolf(fmt, ap);
> + va_end(ap);
> }
Each call to this function prepends the timestamp, so it cannot really
be used for a sequence of prints in a single line.
It's a little ugly but I expected something along the lines of
g_strdup_vprintf() in virtio_error():
char *msg;
va_start(ap, fmt);
msg = g_strdup_vprintf(fmt, ap);
va_end(ap);
error_report("%s: %s", DEVICE(vdev)->id, msg);
g_free(msg);
https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strdup-vprintf
Stefan
signature.asc
Description: PGP signature
- [Qemu-devel] [PATCH v2 0/8] virtio: enhance virtio_error messages, Ladi Prosek, 2017/07/13
- Re: [Qemu-devel] [PATCH v2 1/8] qemu-error: introduce error_report_nolf, Daniel P. Berrange, 2017/07/14
- Re: [Qemu-devel] [PATCH v2 1/8] qemu-error: introduce error_report_nolf, Ladi Prosek, 2017/07/17
- Re: [Qemu-devel] [PATCH v2 1/8] qemu-error: introduce error_report_nolf, Daniel P. Berrange, 2017/07/17
- Re: [Qemu-devel] [PATCH v2 1/8] qemu-error: introduce error_report_nolf, Ladi Prosek, 2017/07/17
[Qemu-devel] [PATCH v2 2/8] virtio: enhance virtio_error messages, Ladi Prosek, 2017/07/13