error: Simplify error sink setup
[qemu/aliguori-queue.git] / qemu-error.c
blob63bcdcfa1a85826bb1982516b18f45549de752af
1 #include <stdio.h>
2 #include "monitor.h"
3 #include "sysemu.h"
5 void qemu_error(const char *fmt, ...)
7 va_list args;
9 va_start(args, fmt);
10 if (cur_mon) {
11 monitor_vprintf(cur_mon, fmt, args);
12 } else {
13 vfprintf(stderr, fmt, args);
15 va_end(args);
18 void qemu_error_internal(const char *file, int linenr, const char *func,
19 const char *fmt, ...)
21 va_list va;
22 QError *qerror;
24 va_start(va, fmt);
25 qerror = qerror_from_info(file, linenr, func, fmt, &va);
26 va_end(va);
28 if (cur_mon) {
29 monitor_set_error(cur_mon, qerror);
30 } else {
31 qerror_print(qerror);
32 QDECREF(qerror);