summary refs log tree commit diff stats
path: root/util/error.c
diff options
context:
space:
mode:
authorAlistair Francis <alistair.francis@xilinx.com>2017-07-12 06:57:52 -0700
committerMarkus Armbruster <armbru@redhat.com>2017-07-13 13:50:19 +0200
commite43ead1d0b9c467af4a2af8f5177316a0ccb5602 (patch)
tree1248feb328e200e4c8e32c1bd0daa148d4a555ae /util/error.c
parentc51c4f88072e7c598514a96d7e31b2a46520eca7 (diff)
downloadfocaccia-qemu-e43ead1d0b9c467af4a2af8f5177316a0ccb5602.tar.gz
focaccia-qemu-e43ead1d0b9c467af4a2af8f5177316a0ccb5602.zip
error: Implement the warn and free Error functions
Implement warn_report_err() and warn_reportf_err() functions which
are the same as the error_report_err() and error_reportf_err()
functions except report a warning instead of an error.

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <276ff93eadc0b01b8243cc61ffc331f77922c0d0.1499866456.git.alistair.francis@xilinx.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'util/error.c')
-rw-r--r--util/error.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/util/error.c b/util/error.c
index 020b86b9f0..3efdd69162 100644
--- a/util/error.c
+++ b/util/error.c
@@ -232,6 +232,15 @@ void error_report_err(Error *err)
     error_free(err);
 }
 
+void warn_report_err(Error *err)
+{
+    warn_report("%s", error_get_pretty(err));
+    if (err->hint) {
+        error_printf_unless_qmp("%s", err->hint->str);
+    }
+    error_free(err);
+}
+
 void error_reportf_err(Error *err, const char *fmt, ...)
 {
     va_list ap;
@@ -242,6 +251,17 @@ void error_reportf_err(Error *err, const char *fmt, ...)
     error_report_err(err);
 }
 
+
+void warn_reportf_err(Error *err, const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    error_vprepend(&err, fmt, ap);
+    va_end(ap);
+    warn_report_err(err);
+}
+
 void error_free(Error *err)
 {
     if (err) {