[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/13] qerror: add qerror_from_args() to create qerr
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PATCH 08/13] qerror: add qerror_from_args() to create qerror objects |
Date: |
Tue, 14 Jun 2011 19:18:26 +0100 |
There is no convenient way to create a QError object without reporting
it immediately. This patch adds the qerror_from_args() function to make
it easy to create an error in qerror_report() style but without
reporting it.
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
qerror.c | 21 +++++++++++++++++++++
qerror.h | 6 ++++++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/qerror.c b/qerror.c
index d7fcd93..64b41ca 100644
--- a/qerror.c
+++ b/qerror.c
@@ -443,6 +443,27 @@ void qerror_print(QError *qerror)
QDECREF(qstring);
}
+/**
+ * qerror_from_args_internal(): Create a new QError
+ *
+ * This is a convenience wrapper of the qerror_from_info() function for when a
+ * va_list is not available.
+ *
+ * Return a strong reference.
+ */
+QError *qerror_from_args_internal(const char *file, int linenr,
+ const char *func, const char *fmt, ...)
+{
+ va_list va;
+ QError *qerror;
+
+ va_start(va, fmt);
+ qerror = qerror_from_info(file, linenr, func, fmt, &va);
+ va_end(va);
+
+ return qerror;
+}
+
void qerror_report_internal(const char *file, int linenr, const char *func,
const char *fmt, ...)
{
diff --git a/qerror.h b/qerror.h
index 16c830d..173c84f 100644
--- a/qerror.h
+++ b/qerror.h
@@ -35,6 +35,12 @@ typedef struct QError {
QError *qerror_new(void);
QError *qerror_from_info(const char *file, int linenr, const char *func,
const char *fmt, va_list *va) GCC_FMT_ATTR(4, 0);
+QError *qerror_from_args_internal(const char *file, int linenr,
+ const char *func, const char *fmt,
+ ...) GCC_FMT_ATTR(4, 0);
+#define qerror_from_args(fmt, ...) \
+ qerror_from_args_internal(__FILE__, __LINE__, __func__, \
+ fmt, ## __VA_ARGS__)
QString *qerror_human(const QError *qerror);
void qerror_print(QError *qerror);
void qerror_report_internal(const char *file, int linenr, const char *func,
--
1.7.5.3
- [Qemu-devel] [PATCH 00/13] QED image streaming, Stefan Hajnoczi, 2011/06/14
- [Qemu-devel] [PATCH 06/13] qed: add support for copy-on-read, Stefan Hajnoczi, 2011/06/14
- [Qemu-devel] [PATCH 07/13] qed: avoid deadlock on emulated synchronous I/O, Stefan Hajnoczi, 2011/06/14
- [Qemu-devel] [PATCH 09/13] block: add bdrv_aio_copy_backing(), Stefan Hajnoczi, 2011/06/14
- [Qemu-devel] [PATCH 04/13] qed: extract qed_start_allocating_write(), Stefan Hajnoczi, 2011/06/14
- [Qemu-devel] [PATCH 13/13] trace: trace bdrv_aio_readv/writev error paths, Stefan Hajnoczi, 2011/06/14
- [Qemu-devel] [PATCH 05/13] qed: make qed_aio_write_alloc() reusable, Stefan Hajnoczi, 2011/06/14
- [Qemu-devel] [PATCH 12/13] qed: intelligent streaming implementation, Stefan Hajnoczi, 2011/06/14
- [Qemu-devel] [PATCH 08/13] qerror: add qerror_from_args() to create qerror objects,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 10/13] qmp: add QMP support for stream commands, Stefan Hajnoczi, 2011/06/14
- [Qemu-devel] [PATCH 11/13] block: add -drive stream=on|off, Stefan Hajnoczi, 2011/06/14
- [Qemu-devel] [PATCH 03/13] qed: replace is_write with flags field, Stefan Hajnoczi, 2011/06/14
- [Qemu-devel] [PATCH 01/13] qemu-config: }, { -> }, { to please checkpatch.pl, Stefan Hajnoczi, 2011/06/14
- [Qemu-devel] [PATCH 02/13] block: add -drive copy-on-read=on|off, Stefan Hajnoczi, 2011/06/14
- Re: [Qemu-devel] [PATCH 00/13] QED image streaming, Philipp Hahn, 2011/06/15
- [Qemu-devel] Image streaming and live block copy (was: [PATCH 00/13] QED image streaming), Kevin Wolf, 2011/06/16