Revision 0167f772

b/qemu-error.c
207 207
    va_end(ap);
208 208
    error_printf("\n");
209 209
}
210

  
211
void qerror_report_internal(const char *file, int linenr, const char *func,
212
                            const char *fmt, ...)
213
{
214
    va_list va;
215
    QError *qerror;
216

  
217
    va_start(va, fmt);
218
    qerror = qerror_from_info(file, linenr, func, fmt, &va);
219
    va_end(va);
220

  
221
    if (monitor_cur_is_qmp()) {
222
        monitor_set_error(cur_mon, qerror);
223
    } else {
224
        qerror_print(qerror);
225
        QDECREF(qerror);
226
    }
227
}
b/qemu-error.h
37 37
void error_print_loc(void);
38 38
void error_set_progname(const char *argv0);
39 39
void error_report(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
40
void qerror_report_internal(const char *file, int linenr, const char *func,
41
                            const char *fmt, ...)
42
    __attribute__ ((format(printf, 4, 5)));
43

  
44
#define qerror_report(fmt, ...) \
45
    qerror_report_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
46 40

  
47 41
#endif
b/qerror.c
9 9
 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
10 10
 * See the COPYING.LIB file in the top-level directory.
11 11
 */
12

  
13
#include "monitor.h"
12 14
#include "qjson.h"
13 15
#include "qerror.h"
14 16
#include "qemu-common.h"
......
377 379
    QDECREF(qstring);
378 380
}
379 381

  
382
void qerror_report_internal(const char *file, int linenr, const char *func,
383
                            const char *fmt, ...)
384
{
385
    va_list va;
386
    QError *qerror;
387

  
388
    va_start(va, fmt);
389
    qerror = qerror_from_info(file, linenr, func, fmt, &va);
390
    va_end(va);
391

  
392
    if (monitor_cur_is_qmp()) {
393
        monitor_set_error(cur_mon, qerror);
394
    } else {
395
        qerror_print(qerror);
396
        QDECREF(qerror);
397
    }
398
}
399

  
380 400
/**
381 401
 * qobject_to_qerror(): Convert a QObject into a QError
382 402
 */
b/qerror.h
37 37
                         const char *fmt, va_list *va);
38 38
QString *qerror_human(const QError *qerror);
39 39
void qerror_print(QError *qerror);
40
void qerror_report_internal(const char *file, int linenr, const char *func,
41
                            const char *fmt, ...)
42
    __attribute__ ((format(printf, 4, 5)));
43
#define qerror_report(fmt, ...) \
44
    qerror_report_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__)
40 45
QError *qobject_to_qerror(const QObject *obj);
41 46

  
42 47
/*

Also available in: Unified diff