mirror of
https://github.com/mborgerson/xemu.git
synced 2025-12-01 16:10:01 +00:00
qemu-error: add {error, warn}_report_once_cond
Add two functions to print an error/warning report once depending on a passed-in condition variable and flip it if printed. This is useful if you want to print a message not once-globally, but e.g. once-per-device. Inspired by warn_once() in hw/vfio/ccw.c, which has been replaced with warn_report_once_cond(). Signed-off-by: Cornelia Huck <cohuck@redhat.com> Message-Id: <20180830145902.27376-2-cohuck@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Function comments reworded] Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
committed by
Markus Armbruster
parent
d6f71af654
commit
c55510b722
@ -44,6 +44,11 @@ void error_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
|
||||
void warn_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
|
||||
void info_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
|
||||
|
||||
bool error_report_once_cond(bool *printed, const char *fmt, ...)
|
||||
GCC_FMT_ATTR(2, 3);
|
||||
bool warn_report_once_cond(bool *printed, const char *fmt, ...)
|
||||
GCC_FMT_ATTR(2, 3);
|
||||
|
||||
/*
|
||||
* Similar to error_report(), except it prints the message just once.
|
||||
* Return true when it prints, false otherwise.
|
||||
|
||||
Reference in New Issue
Block a user