error: Move qerror_report() from qemu-error.[ch] to qerror.[ch]
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
parent
526f0ac153
commit
0167f772d1
18
qemu-error.c
18
qemu-error.c
|
@ -207,21 +207,3 @@ void error_report(const char *fmt, ...)
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
error_printf("\n");
|
error_printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void qerror_report_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);
|
|
||||||
|
|
||||||
if (monitor_cur_is_qmp()) {
|
|
||||||
monitor_set_error(cur_mon, qerror);
|
|
||||||
} else {
|
|
||||||
qerror_print(qerror);
|
|
||||||
QDECREF(qerror);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -37,11 +37,5 @@ void error_printf_unless_qmp(const char *fmt, ...)
|
||||||
void error_print_loc(void);
|
void error_print_loc(void);
|
||||||
void error_set_progname(const char *argv0);
|
void error_set_progname(const char *argv0);
|
||||||
void error_report(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
|
void error_report(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
|
||||||
void qerror_report_internal(const char *file, int linenr, const char *func,
|
|
||||||
const char *fmt, ...)
|
|
||||||
__attribute__ ((format(printf, 4, 5)));
|
|
||||||
|
|
||||||
#define qerror_report(fmt, ...) \
|
|
||||||
qerror_report_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
20
qerror.c
20
qerror.c
|
@ -9,6 +9,8 @@
|
||||||
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
||||||
* See the COPYING.LIB file in the top-level directory.
|
* See the COPYING.LIB file in the top-level directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "monitor.h"
|
||||||
#include "qjson.h"
|
#include "qjson.h"
|
||||||
#include "qerror.h"
|
#include "qerror.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
@ -377,6 +379,24 @@ void qerror_print(QError *qerror)
|
||||||
QDECREF(qstring);
|
QDECREF(qstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qerror_report_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);
|
||||||
|
|
||||||
|
if (monitor_cur_is_qmp()) {
|
||||||
|
monitor_set_error(cur_mon, qerror);
|
||||||
|
} else {
|
||||||
|
qerror_print(qerror);
|
||||||
|
QDECREF(qerror);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qobject_to_qerror(): Convert a QObject into a QError
|
* qobject_to_qerror(): Convert a QObject into a QError
|
||||||
*/
|
*/
|
||||||
|
|
5
qerror.h
5
qerror.h
|
@ -37,6 +37,11 @@ QError *qerror_from_info(const char *file, int linenr, const char *func,
|
||||||
const char *fmt, va_list *va);
|
const char *fmt, va_list *va);
|
||||||
QString *qerror_human(const QError *qerror);
|
QString *qerror_human(const QError *qerror);
|
||||||
void qerror_print(QError *qerror);
|
void qerror_print(QError *qerror);
|
||||||
|
void qerror_report_internal(const char *file, int linenr, const char *func,
|
||||||
|
const char *fmt, ...)
|
||||||
|
__attribute__ ((format(printf, 4, 5)));
|
||||||
|
#define qerror_report(fmt, ...) \
|
||||||
|
qerror_report_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
|
||||||
QError *qobject_to_qerror(const QObject *obj);
|
QError *qobject_to_qerror(const QObject *obj);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue