From 2ee2f1e41517efa7b5dd604a68ceca9b1377de2c Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 6 Feb 2015 15:27:19 +0100 Subject: error: New convenience function error_report_err() I've typed error_report("%s", error_get_pretty(ERR)) too many times already, and I've fixed too many instances of qerror_report_err(ERR) to error_report("%s", error_get_pretty(ERR)) as well. Capture the pattern in a convenience function. Since it's almost invariably followed by error_free(), stuff that into the convenience function as well. The next patch will put it to use. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- util/error.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'util') diff --git a/util/error.c b/util/error.c index 2ace0d8dd9..1ff6ae538b 100644 --- a/util/error.c +++ b/util/error.c @@ -152,6 +152,12 @@ const char *error_get_pretty(Error *err) return err->msg; } +void error_report_err(Error *err) +{ + error_report("%s", error_get_pretty(err)); + error_free(err); +} + void error_free(Error *err) { if (err) { -- cgit v1.2.3